473,395 Members | 1,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

XMLDsign

3
I need help.....

When I sign a XML, if I check the sign and the certificate with this function:

signedXml.CheckSignature(oCertificado, False)

the result is False and say me that the sign is valid but the certificate is not valid.

I don't know why is it. Do I need a special king of certificate?

Code:
0. Dim signedXml As New System.Security.Cryptography.Xml.SignedXml(documen tXML)

1. signedXml.SigningKey = oCertificado.PrivateKey

2. Dim reference As New System.Security.Cryptography.Xml.Reference()
3. reference.Uri = ""
4. reference.AddTransform(New XmlDsigEnvelopedSignatureTransform())
5. reference.AddTransform(New XmlDsigC14NTransform())

6. signedXml.AddReference(reference)

7. Dim KeyName As New KeyInfoName
8. KeyName.Value = "Public key of certificate"

9. Dim keyInfo As New KeyInfo
10. keyInfo.AddClause(KeyName)
11. keyInfo.AddClause(New RSAKeyValue(oCertificado.PublicKey.Key()))
12. keyInfo.AddClause(New KeyInfoX509Data(oCertificado))
13. signedXml.KeyInfo = keyInfo

14. signedXml.ComputeSignature()

My certificate is in CURRENT_USER\My and ASPNET have permiss for this certificate.

Thank you.
Sep 20 '07 #1
0 955

Sign in to post your reply or Sign up for a free account.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.