Skip to content

[ENHANCEMENT]: Making the signature wrap the content that it's signing #466

@mhd3v

Description

@mhd3v

Is your feature request related to a problem? Please describe...

Hi, thank you so much for creating this amazing package. I am trying to make the signature element wrap the content that it is using to generate the signature. Is this possible with this package? I've tried a lot of things, but unfortunately none of the location options seems to support this use-case.

So basically what i'm trying to achieve is something like below:

<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
 <ds:SignedInfo>
 <ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
 <ds:SignatureMethod Algorithm="http://www.w3.org/2007/05/xmldsig-more#sha256-rsaMGF1"/>
 <ds:Reference URI="#object">
 <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
 <ds:DigestValue><!-- insert base64-encoded digest value --></ds:DigestValue>
 </ds:Reference>
 </ds:SignedInfo>
 <ds:SignatureValue><!-- insert base64-encoded signature --></ds:SignatureValue>
 <ds:KeyInfo>
 <ds:X509Data>
 <ds:X509SubjectName><!-- Insert subject name --></ds:X509SubjectName>
 <ds:X509Certificate><!-- Insert base64-encoded certificate --></ds:X509Certificate>
 </ds:X509Data>
 </ds:KeyInfo>
 <ds:Object Id="object">
 <dip xmlns="http://itzbund.de/ozg/bzst/post/dip/v1/" version="1.0">
 <header environment="TEST">
 ...
 </header>
 <body>
 ...
 </body>
 </dip>
 </ds:Object>
</ds:Signature>

Describe the solution you'd like...

A mechanism to allow the signature to wrap the content.

Describe the alternatives you've considered...

Tried to move the signature after the xml is signed, but it causes the verification to fail.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions