I have this code to sign an XML, because at that moment it requests a URI, I know it is a namespace that points to some website, but when I assign the URL, it gives an exception error.
' Cria a referencia
Dim reference As New Reference()
' Pega a URI para ser assinada
Dim _Uri As XmlAttributeCollection = docXML.GetElementsByTagName(uri).Item(0).Attributes
For Each _atributo As XmlAttribute In _Uri
If _atributo.Name = "id" Then
reference.Uri = "#" + _atributo.InnerText
End If
Next
I pass the following URI: link And I use the following XML:
<?xml version="1.0"?>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.altova.com/"/>
<ds:SignatureMethod Algorithm="http://www.altova.com/"/>
<ds:Reference>
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue/>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue/>
<ds:KeyInfo>
<ds:X509Data>
<ds:X509Certificate/>
</ds:X509Data>
</ds:KeyInfo>