[英]Getting error while signing xml document with X509Certificate(SalesForce certificate) in C# for Single Sign-On SAML post
我正在尝试使用SAML POST
Single Sign-On
到SalesForce。 我已经创建了SalesForce沙箱帐户, Certificate and Key Management
从Certificate and Key Management
下载了Certificate
。 我在C#代码中使用了该Certificate
,但是它给出了错误Signing key is not loaded.
在下面的代码
XmlElement signature = SigningHelper.SignDoc(xmlDocument, certificate, "ID", refValue);
在调试时,我发现它在创建证书实例时如下
certificate = new X509Certificate2("d:/certificate.crt", "testpassword", X509KeyStorageFlags.Exportable);
实例已创建,但属性certificate.PrivateKey
仍为null,原因可能是它给出了错误Signing key is not loaded.
任何想法如何使用证书创建签名?
经过大量的研发,我了解了C#代码
XmlElement signature = SigningHelper.SignDoc(xmlDocument, certificate, "ID", refValue);
需要证书的私钥文件,而我尝试使用公钥文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.