是什么原因导致System.Security.Cryptography.CryptographicException? [英] What could be causing a System.Security.Cryptography.CryptographicException?

查看:77
本文介绍了是什么原因导致System.Security.Cryptography.CryptographicException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在开发一个创建SAML断言,将其转换为XML,然后尝试使用x.509证书对其进行签名的应用.
创建断言后,我创建了一个名为xmlDoc的XML文档.我已经测试了xmlDoc,它是正确的.
我正在使用的证书是:

X509Certificate2 cert = X509Certificate2 (store.Certificates [0]);

Hi All,

I'm working on an app that creates a SAML assertion, converts it to XML, and then attempts to sign it using an x.509 certificate.
After creating the assertion, I create an XML document called xmlDoc. I've tested the xmlDoc, and it is correct.
The cert I'm using is:

X509Certificate2 cert = new X509Certificate2(store.Certificates[0]);

SignedXml sig = SignedXml ();

SignedXml sig = new SignedXml();

System.Security.Cryptography. RSA 键= System.Security.Cryptography. RSA .Create();

sig.SigningKey = key;

System.Security.Cryptography.RSA key = System.Security.Cryptography.RSA.Create();

sig.SigningKey = key;

DataObject dataObject = new DataObject ();

DataObject dataObject = new DataObject();

dataObject.Data = xmlDoc.ChildNodes;

dataObject.Data = xmlDoc.ChildNodes;

sig.AddObject(dataObject);

sig.AddObject(dataObject);

KeyInfo keyInfo = KeyInfo ();

KeyInfo keyInfo = new KeyInfo();

keyInfo.AddClause( RSAKeyValue (键));

keyInfo.AddClause(new RSAKeyValue(key));

sig.KeyInfo = keyInfo;

sig.KeyInfo = keyInfo;

sig.SigningKey = cert.PrivateKey;

sig.SigningKey = cert.PrivateKey;

任何人都可以帮助我弄清楚我做错了什么(或者如果我应该以其他方式对XML签名)?提前非常感谢!

Can anyone help me figure out what I am doing wrong (or if I should be signing the XML in a different way)? Thanks very much in advance!!

推荐答案



感谢您的发帖!不幸的是,目前没有论坛来发布您要提问的问题,因此我建议您将问题发布到位于以下位置的基于安全的密码学新闻组之一:http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public. security.crypto

希望有帮助!


这篇关于是什么原因导致System.Security.Cryptography.CryptographicException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆