Skip to content

Add Reference for the KeyInfo node #374

@brugambwa

Description

@brugambwa

Discussed in #362

Originally posted by brugambwa July 26, 2023

EDIT: The first reference and the digest is calculated on the KeyInfo tag, which is added using the getKeyInfoContent. So the addReference cannot find the reference to the KeyInfo tag as it's not part of the initial XML. Is there an implementation I could use/change in the library to be able to produce the output below?

    <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
        <ds:SignedInfo>
            <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
            <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
            <ds:Reference URI="#f2f98882-502f-4110-8be3-4e50716740fb">
                <ds:Transforms>
                    <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                </ds:Transforms>
                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                <ds:DigestValue>Some Digest</ds:DigestValue>
            </ds:Reference>
            <ds:Reference URI="">
                <ds:Transforms>
                    <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
                    <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                </ds:Transforms>
                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                <ds:DigestValue>Some Digest</ds:DigestValue>
            </ds:Reference>
            <ds:Reference>
                <ds:Transforms>
                    <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                </ds:Transforms>
                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                <ds:DigestValue>Some Digest</ds:DigestValue>
            </ds:Reference>
        </ds:SignedInfo>
        <ds:SignatureValue>Signature-Value</ds:SignatureValue>
        <ds:KeyInfo Id="f2f98882-502f-4110-8be3-4e50716740fb">
            <ds:KeyValue>
                <ds:RSAKeyValue>
                    <ds:Modulus>Some-Modulus String</ds:Modulus>
                    <ds:Exponent>AQAB</ds:Exponent>
                </ds:RSAKeyValue>
            </ds:KeyValue>
            <ds:X509Data>
                <ds:X509Certificate>CertificateInfo</ds:X509Certificate>
            </ds:X509Data>
        </ds:KeyInfo>
    </ds:Signature></div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions