0

I am trying to create SAML Assertion in c#, but when I try to serialized it using WriteToken method of WSSecurityTokenSerializer class, it gives me the following exception

"The private key is not present in the X.509 certificate"

I have created the certificate using the following command,

makecert -r -pe -n "CN=CompanyXYZ Server" -b 01/01/2007 -e 01/01/2012 -sky exchange Server.cer

And for SAML assertion creation I am following the tutorial from link text

I am wondering how I am generate certificate which contains private key. Or this is any way around to (create / read) un-signed SAML Assertions.

4

1 回答 1

3

你猜怎么着......我想通了。我没有使用 .cer 证书文件,而是使用了 .pfx 文件并在 X509Certificate2 的初始化期间指定了私钥密码。

IE

string path = @"D:\projects\SAMLDemo\Server.pfx";

X509Certificate2 cert = new X509Certificate2(path,"password");
于 2011-01-05T02:28:54.073 回答