crewjam / go-xmlsec

golang bindings for xmlsec
BSD 2-Clause "Simplified" License
26 stars 13 forks source link

Add signing with X509 certificate #24

Closed phongphan closed 2 years ago

phongphan commented 2 years ago

Hi,

I have a use case that the server requires the X509Certificate. I think it's a bit more convenient to let the xmlsec fill the X509IssuerSerial and X509Certificate as in template below automatically instead of prerendering them.

<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="">
            <Transforms>
                <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
            <DigestValue></DigestValue>
        </Reference>
    </SignedInfo>
    <SignatureValue/>
    <KeyInfo>
        <X509Data>
            <X509IssuerSerial/>
            <X509Certificate/>
        </X509Data>
    </KeyInfo>
</Signature>