PeculiarVentures/xadesjs

Generate a brazilian NFe signature standard node.

Opened this issue · 0 comments

I am trying to sign a Brazilian NFe XML, using this library. I was able to implement the signing using Fortify to access a token certificate. However, the resulting is completely different from a valid NFe signature node. Below is an example of a valid NFe signature node:

<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
            <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="#NFe35231047960950089785550520001403941083215372">
                <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>Hs8SCmlHApai7Frfd6JUz6hdezU=</DigestValue>
            </Reference>
        </SignedInfo>
        <SignatureValue>DII...g==</SignatureValue>
        <KeyInfo>
            <X509Data>
                <X509Certificate>MIIH...jfN</X509Certificate>
            </X509Data>
        </KeyInfo>
    </Signature>

How can I generate a similar signature node? What should be my approach to achieve this?