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

AllSignedDataObjects - undefined ? #137

Open
asukisun opened this issue Oct 23, 2023 · 1 comment
Open

AllSignedDataObjects - undefined ? #137

asukisun opened this issue Oct 23, 2023 · 1 comment

Comments

@asukisun
Copy link

Thank you for developing such a useful library.
Regarding the output part of "AllSignedDataObjects", I would like you to check if there are any problems with the logic.

I am trying to generate the following output using XML signatures with xadesjs.

<xades:SignedDataObjectProperties>
    <xades:CommitmentTypeIndication>
        <xades:CommitmentTypeId>
            <xades:Identifier Qualifier="OIDAsURN">urn:oid:1.2.840.113549.1.9.16.6.1</xades:Identifier>
        </xades:CommitmentTypeId>
        <xades:AllSignedDataObjects/>
    </xades:CommitmentTypeIndication>
</xades:SignedDataObjectProperties>

#Here is the relevant code snippet:

const commitmentTypeIndication = new xadesjs.xml.CommitmentTypeIndication();

commitmentTypeIndication.CommitmentTypeId.Identifier.Qualifier = "OIDAsURN";
commitmentTypeIndication.CommitmentTypeId.Identifier.Value = ["urn:oid:1.2.840.113549.1.9.16.6.1"];

commitmentTypeIndication.AllSignedDataObjects = true;
commitmentTypeIndication.MimeType = "text/xml";

signedXml.SignedProperties.SignedDataObjectProperties.DataObjectFormats.Add(commitmentTypeIndication);

// (omission)
signedDocument = signedXml.Sign(  (omission) );

When I put some value into commitmentTypeIndication.AllSignedDataObjects
I get <xades:AllSignedDataObjects>undefined</xades:AllSignedDataObjects>
in the output.

However, it always appears as
<xades:AllSignedDataObjects>undefined</xades:AllSignedDataObjects>

No matter what value I enter, "undefined" is output.

Is this "undefined" behavior intentional?

ーーー
#Actual_Output

<xades:SignedDataObjectProperties>
    <xades:CommitmentTypeIndication>
        <xades:CommitmentTypeId>
            <xades:Identifier Qualifier="OIDAsURN">urn:oid:1.2.840.113549.1.9.16.6.1</xades:Identifier>
        </xades:CommitmentTypeId>
        <xades:AllSignedDataObjects>undefined</xades:AllSignedDataObjects>
    </xades:CommitmentTypeIndication>
</xades:SignedDataObjectProperties>
@asukisun
Copy link
Author

Two points to add:

1,
Changing to commitmentTypeIndication.AllSignedDataObjects = ""; also yields the same result.

2,
If the line commitmentTypeIndication.AllSignedDataObjects = true;
is commented out, the AllSignedDataObjects element disappears from the signature.

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