472,958 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

SignedXML.CheckSignature() not working

I'm using Michael Gallants DecodeCertKey example to get the public key
from an X509 certificate. I then create an RSAServiceProvider and try
to use it to CheckSignature() on the signed XML file. Other sources
such as http://www.infomosaic.net/XMLSign/SecureXMLVerifyWS.htm can
verify the signature, but .Net won't. Any ideas?

Here is the code I'm using:

' Verify the signature of an XML file and return the result.
Public Shared Function VerifyXmlFile(ByVal Name As String) As
Boolean

' Create a new XML document.
Dim xmlDocument As New XmlDocument

' Format using white spaces.
xmlDocument.PreserveWhitespace = True

' Load the passed XML file into the document.
xmlDocument.Load(Name)

Dim oRSA As RSACryptoServiceProvider
' Load the X509 certificate.
Dim x509Cert As X509Certificate =
X509Certificate.CreateFromCertFile("mycert.cer")

'//Create a new instance of RSACryptoServiceProvider.
oRSA = DecodeCertKey.DecodeObject(x509Cert.GetPublicKey() )

' Create a new SignedXml object and pass it
' the XML document class.
Dim signedXml As New SignedXml

' Find the "Signature" node and create a new
' XmlNodeList object.
Dim nodeList As XmlNodeList =
xmlDocument.GetElementsByTagName("ds:Signature")

' Load the signature node.
signedXml.LoadXml(CType(nodeList(0), XmlElement))

' Check the signature and return the result.
Return signedXml.CheckSignature(oRSA)

End Function
Nov 12 '05 #1
0 3550

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Raghu | last post by:
I am using SignedXml class to sign and verify soap xml documents. We are not using WSE at this point. When I sign a soap document and send it to my trading partner, they can verify the document...
0
by: pak76 | last post by:
Class SignedXml is used to produce/verify signature over XML document. One of its methods, function GetIdElement, is used to select Xml elements for signature and verification and consist following...
2
by: Nikhil | last post by:
When I try to used the CheckSignature Method of SignedXML I get the following error. "Unknown transform has been encountered. at System.Security.Cryptography.Xml.Reference.LoadXml(XmlElement...
4
by: Karol | last post by:
Hello, I'm trying to create signed XML document with SignedXml class. As a SigningKey I'd like to use key pair obtained from user certificate stored in current user certificate store. I'm using...
2
by: William Stacey [MVP] | last post by:
Given the following, how do I get the plain xml without the security elements (i.e. the original xml before the security was added) in the VerifyXML() method. TIA. using System; using...
2
by: Rune Nergard | last post by:
I have tried to use the System.Security.Cryptography.Xml.SignedXml class to sign an Xml message with Xml-DSIG and using an Enveloped signature type and the sha1RSA algorithm. Everything works fine...
1
by: Peter Ravnholt | last post by:
Hello all, It seems that digitally signing XML documents using the SignedXml class has a bug - or at least a behavior I cannot explain. The problem occurs when I sign XML documents containing...
0
by: | last post by:
Hey Friends, I have a Signed XML that looks like the below I also have the public certificate for this but i am not able to pass the public key of the X509Certificate2 to the CheckSignature method...
0
by: Iguana | last post by:
Hi! Im creating project in c# .net2.0, to sign and verify documens us xmldsig format. My problem is how to use prefix "ds" instead of: xmlns="http://www.w3.org/2000/09/xmldsig#" in SignedInfo,...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.