SIGNEDXML

Hi, I have the following problem:

I need to sign a XML Document whith SignedXML in Visual Basic .Net. When i
signed the xml document and use the id Attribute in the next format "Id"
this work, but, when i do the same but i only replace the id attribute for
"ID" this does not work and gives me the message "Malformed Reference
Element".

For instance:


This is my XML

<mydocument ID="myfirstdocument">
......
</mydocument>

This is my code in VB.NET....

reference.uri="#myfirstdocument"...


The above sample does not work

This other XML

<mydocument Id="myfirstdocument">
......
</mydocument>


This is my code in VB.NET
...
reference.uri="#myfirstdocument"
...


The above sample works


The question is: How do i sign the xml whith the "ID" attribute.

Thanks a lot...
Pablo
0
ppombo (4)
11/12/2003 2:19:31 PM
dotnet.xml 7266 articles. 0 followers. Follow

1 Replies
769 Views

Similar Articles

[PageSpeed] 42

Pablo,

Excuse me if I've misunderstood you, but you are aware that XML is
case-sensitive, yes?

Regards,

     -djm


0
11/12/2003 2:38:57 PM
Reply:

Similar Artilces:

XmlDsigC14NTransform signedXml.ComputeSignature()
1. signedXml.ComputeSignature() outputs a digest value of something. what is it? I mean, how can i get it? I get the canonical form of my xml with XmlDsigC14NTransform then digest it but the digest value is different. 2.signedXml.ComputeSignature() uses XmlDsigC14NTransform. But how? What are the parameters? I also need to obtain canonicalized XML in C14N format, but I haven't discovered how to do it. When I compare the DigestValue gen'd by ComputeSignature and my own DigestValue gen'd using ComputeHash, I get different values, but only when namespaces are involved. "Lemba...

SignedXML #2
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 WSE 2 SP 2 to get certificate, but when I'm invoking ComputeSignature() method of SignedXML instance I recive the following exception: "An unhandled exception of type 'System.NotSupportedException' occurred in microsoft.web.services2.dll Additional information: DecryptValue" I'd also like to mention, that when I try to export key's parameters I recive the fol...

SIGNEDXML
Hi, I have the following problem: I need to sign a XML Document whith SignedXML in Visual Basic .Net. When i signed the xml document and use the id Attribute in the next format "Id" this work, but, when i do the same but i only replace the id attribute for "ID" this does not work and gives me the message "Malformed Reference Element". For instance: This is my XML <mydocument ID="myfirstdocument"> ...... </mydocument> This is my code in VB.NET.... reference.uri="#myfirstdocument"... The above sample does not work This other...

SignedXml.CheckSignature returns false when the root element has namespace declarations
Hi, I am using SignedXml with RSACryptoServiceProvider to sign some XML. the verification seems to work OK if there is no namespace declaration on the root element of the XML but if there is one it always returns false. here's a complete example: XmlDocument doc = new XmlDocument(); doc.LoadXml("<foo xmlns:foo=\"foo\" />"); SignedXml sx = new SignedXml(doc); RSACryptoServiceProvider csp = new RSACryptoServiceProvider(); sx.SigningKey = csp; Reference refe = new Reference(""); sx.AddReference(refe); sx.ComputeSignature(); XmlElement signature = sx.GetX...

Issues with SignedXml Class
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 line: xmlElement = document.SelectSingleNode(String.Concat("//*[@Id=\"", idValue, "\"]")) is XmlElement; I can see two issues with this line 1. URI injection - there is no validation of idValue whatsoever; therefore I can successfully validate document below (see what is the URI). I have control over XPATH query you are performing. Although I cannot find any "da...

What to digest when signedXml.ComputeSignature()?
I use signedXml.ComputeSignature() method and save it to an xml file (=output.xml). There is a digest value of "something" in it. Actually it is some form of my input xml but not just the canonical form of my xml. (is there some additional headers?) What is "something" exactly? What is digested exactly when signedXml.ComputeSignature()? The digest value of myOutput.xml (explained below) is not equal to the digest value in output.xml. Why? XmlDocument doc = new XmlDocument(); doc.Load("input.xml"); XmlDsigC14NTransform canon = new XmlDsigC14NTransform(true); can...

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 ...

SignedXML throws error
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 value)\r\n at System.Security.Cryptography.Xml.SignedInfo.LoadXml(XmlElement value)\r\n at System.Security.Cryptography.Xml.Signature.LoadXml(XmlElement value)\r\n at System.Security.Cryptography.Xml.SignedXml.LoadXml(XmlElement value)\r\n at SAML.Form1.button2_Click(Object sender, EventArgs e) in d:\\omtest\\saml\\form1.cs:line 295" string Any ideas what might be going wrong,...

SignedXml ds prefix
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, SignatureValue and KeyInfo node and their child nodes? I add xmlns:ds="http://www.w3.org/2000/09/xmldsig#" attribute to xmlDocument. After call ComputeSignature method, I add to signature xmlElement (XmlElement xmlDigitalSignature = signedXml.GetXml()) frefix ds (xmlDigitalSignature.Prefix = "ds") - this change xmlns="http://www.w3.org/2000/09/xmldsig#" ...

SignedXML signature assigning a prefix.
Hi all, I've Signed an XML document using x509 cert - no probs. I get an output of <Signature....>....</Signature> 64 Million dollar question: How to get this: <dsig:Signature.....>...</dsig:Signature> In otherwords, how to tell SignedXML Class to use a prefx of (in my case) 'dsig'? You have 3 lifelines and a phone a friend handy. Any help here would just be too good!! Thousand thanks in advance, Mick. ...

Urgent Help with CheckSignature method of SignedXml
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 any idea or help? <?xml version="1.0" encoding="UTF-8"?> <B:Envelope xmlns:B="http://schemas.xmlsoap.org/soap/envelope/" xmlns:A="http://www.routeone.com/namespace.messaging.diag#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP:Header xmlns:SOAP-SEC="http://schemas.xmlsoap.org/soap/security/2000-12" xmlns:S...

SignedXml, X509Certificate2 and certificates with *Strong* protection
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 with soft certificates and some smartcard based certificates. I'm using X509Certificate2 to hold the certificates. My problem is that our customers is forced (by law!) to use a smart-card based personal certificate with strong protection. That is a certificate that can't be accessed without the user being informed. If a message is to be signed, the user will have to punch his pi...

Help - Soap Message - SignedXml - Apache Xml Security Suite
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 without any problem. However when they send me the signed soap document, I am not able to verify it. But they can take their signed document and can verify it without any problem. They are using Apache Xml Security Suite (v 1.0.4). One thing we noticed is that SignedXml class does not add any prefix to the Signature element. But the Apache suite adds it. However both namespace values are pointing to sa...

Which type of digital certificate to get from VeriSign for SignedXML
Hi all, Happy New Year. I am using SignedXML and an X509 certificate to digitally sign a SOAP message body and put the signature in the SOAP header for a B2B business application. Can you suggest which type of digital certificates from VeriSign is for this purpose? I checked VeriSign's web site but didn't find it obvious to decide. Thank you very much for your help. --- Guangxi Hi Guangxi, What about the Secure Site Services? SSL certificates are ideal for securing Web sites, intranets and extranets. It's cheap and guarantee every SSL session will receive powerful SSL enc...

Getting SignedXML to Emit Namespace-Qualified XML
I posted this to the security group with no luck. When I call SignedXML.ComputeSignature, then call SignXML.GetXML, I get XML that is not namespace-qualified. That is, the Signature node is named Signature rather than ds:Signature. Is there a way to make SignXML emit namespace-qualified XML? On Mar 19, 8:05=A0am, Stephen Wood <stephe...@gmail.com> wrote: > I posted this to the security group with no luck. > > When I call SignedXML.ComputeSignature, then call SignXML.GetXML, I > get > XML that is not namespace-qualified. =A0That is, the Signature node is > named Sign...

SignedXml gives false negatives when using namespaces in signed xm
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 namespace prefixes and namespace references and then validate it. The validation always fails (returns false) in this case. When I remove the namespace prefixes and namespace references from the XML, signing and validating works fine. It seems that the problem has been recognized in .NET framework 1.1 (see http://support.microsoft.com/kb/888999/en-us), however I am using .NET 2.0, and the problem...