Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional <ds:Object> to Signature #135

Closed
fmoessle opened this issue Sep 8, 2023 · 0 comments
Closed

Add additional <ds:Object> to Signature #135

fmoessle opened this issue Sep 8, 2023 · 0 comments

Comments

@fmoessle
Copy link

fmoessle commented Sep 8, 2023

Hi!

I currently have an issue adding an additional ds:Object to the signature.

  <ds:Object Id="document.xml">
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</ds:Object>

It should contain a base64 encoded copy of the original XML document that is signed.

How can I do this with xadesjs?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="id-a76888294b20ed5c3bfe171c33e55d45">
  <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 Id="r-document.xml" Type="http://www.w3.org/2000/09/xmldsig#Object"
      URI="#document.xml">
      <ds:Transforms>
        <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#base64" />
      </ds:Transforms>
      <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
      <ds:DigestValue>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</ds:DigestValue>
    </ds:Reference>
    <ds:Reference Type="http://uri.etsi.org/01903#SignedProperties"
      URI="#xades-id-a76888294b20ed5c3bfe171c33e55d45">
      <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>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</ds:DigestValue>
    </ds:Reference>
  </ds:SignedInfo>
  <ds:SignatureValue Id="value-id-a76888294b20ed5c3bfe171c33e55d45">
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</ds:SignatureValue>
  <ds:KeyInfo>
    <ds:X509Data>
      <ds:X509Certificate>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</ds:X509Certificate>
    </ds:X509Data>
  </ds:KeyInfo>
  <ds:Object>
    <xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#"
      Target="#id-a76888294b20ed5c3bfe171c33e55d45">
      <xades:SignedProperties Id="xades-id-a76888294b20ed5c3bfe171c33e55d45">
        <xades:SignedSignatureProperties>
          <xades:SigningTime>2023-06-14T11:23:54Z</xades:SigningTime>
          <xades:SigningCertificateV2>
            <xades:Cert>
              <xades:CertDigest>
                <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha512" />
                <ds:DigestValue>
                  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</ds:DigestValue>
              </xades:CertDigest>
              <xades:IssuerSerialV2>
                xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</xades:IssuerSerialV2>
            </xades:Cert>
          </xades:SigningCertificateV2>
        </xades:SignedSignatureProperties>
        <xades:SignedDataObjectProperties>
          <xades:DataObjectFormat ObjectReference="#r-document.xml">
            <xades:MimeType>text/xml</xades:MimeType>
          </xades:DataObjectFormat>
          <xades:CommitmentTypeIndication>
            <xades:CommitmentTypeId>
              <xades:Identifier>http://uri.etsi.org/01903/v1.2.2#ProofOfOrigin</xades:Identifier>
              <xades:Description>ProofOfOrigin</xades:Description>
            </xades:CommitmentTypeId>
            <xades:AllSignedDataObjects />
          </xades:CommitmentTypeIndication>
          <xades:CommitmentTypeIndication>
            <xades:CommitmentTypeId>
              <xades:Identifier>http://uri.etsi.org/01903/v1.2.2#ProofOfApproval</xades:Identifier>
              <xades:Description>ProofOfApproval</xades:Description>
            </xades:CommitmentTypeId>
            <xades:AllSignedDataObjects />
          </xades:CommitmentTypeIndication>
        </xades:SignedDataObjectProperties>
      </xades:SignedProperties>
    </xades:QualifyingProperties>
  </ds:Object>
  <ds:Object Id="document.xml">
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</ds:Object>
</ds:Signature>
@fmoessle fmoessle closed this as completed Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant