Hi All,
I need to sign a XML document.
Question #1:
Searching in the web, I found samples in C# and Delphi that uses class that I can't found your respective in DF. For example, in this link (in portuguese) have a sample using Delphi and Capicom Dll (obsolete, I know). In this sample, it uses a class named IXMLDigitalSignature, included in msxml5.dll. In C# (here a link in portuguese to C#), have a sample using class SignedXml that can make the signature when we provide the certificate data, xml node to be signed and references to use in signature method.
As I handled few times XML in DF, I did not find this type of class (SignXml or XMLDigitalSignature) searching in the Help.
I can't find how to make nodes like this:
Code:
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#NFe33160812980194000207550010000419251000040578"><Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>hudnT24ub0SYlL1OPFej767sLK4=</DigestValue>
</Reference>
I could only find how to add ElementNS with AddElementNS, and, as expected results in the follow lines:
Code:
<CanonicalizationMethod xmlns="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<SignatureMethod xmlns="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference xmlns="#NFe33160812980194000207550010000419251000040578"/>
How to generate tags like: <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>, with "Algorithm" rather than "xmlns"?
Question #2:
DF has this kind of function for sign the XML (get the DigestValue calculated by a class using the cryptographic service provider)?
Sorry for the poor English and maybe the confusing explanation...
Thanks in advance.