我的客户端使用私钥& amp; IAIK工具。我想解密/验证ASP.NET 2.0中的数据。我有我的客户的公共证书。我尝试过各种方法,但验证失败了。请建议任何验证/解密数据的代码。签名的XML如下
<TrnResponse>
<Transaction>
<Type>TrnResponse</MessageType>
<ReferenceNo>123456</ReferenceNo>
<ClientName>ABCDI</ClientName>
<TReferenceNo>111111</CTReferenceNo>
<Mode>05</Mode>
<Status>SUCCESSFUL</Status>
<TRXDateTime>06-03-2012 13:16:21</TRXDateTime>
<TRXID>001111222</TRXID>
</Transaction>
<Signature> <SignatureValue>MIAGCSqGSIb3DQEHAqCAMIIHlwIBATELMAkGBSsOAwIaBQAwCwYJKoZIhvcNAQcB</SignatureValue>
</Signature>
</TrnResponse>
i am trying following code to verify
XmlDocument Doc = new XmlDocument();
Doc.PreserveWhitespace = false;
Doc.Load(@"d:\data.xml");
SignedXml signedXml = new SignedXml(Doc);
XmlNodeList nodeList = Doc.GetElementsByTagName("Signature");
X509Certificate2 cert = GetRecipientCert(); // method returns public certificate
RSACryptoServiceProvider csp = (RSACryptoServiceProvider)cert.PublicKey.Key;
string publickey = cert.PublicKey.Key.ToXmlString(false);
XmlNodeList xn1 = Doc.GetElementsByTagName("Transaction");
string license_code = xn1.Item(0).OuterXml.ToString();
ASCIIEncoding ByteConverter = new ASCIIEncoding();
byte[] verify_this = ByteConverter.GetBytes(license_code);
string base64_encoded_signature = Doc.GetElementsByTagName("SignatureValue").Item(0).InnerText;
byte[] signature = Convert.FromBase64String(base64_encoded_signature);
bool ok = csp.VerifyData(verify_this, new SHA1CryptoServiceProvider(), signature);
Please help to solve this