-
Notifications
You must be signed in to change notification settings - Fork 49
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
Parallel Signature support #87
Comments
what is described in example 23 at https://www.w3.org/TR/xmldsig-core/#sec-XPath would be perfect to me. |
it seems like using #ID references will be far easier and should just work. I'll comment back in case I make it work. |
looks like we can fix it by updating XmlDsigEnvelopedSignatureTransform public GetOutput(): any {
if (!this.innerXml) {
throw new XmlError(XE.PARAM_REQUIRED, "innerXml");
}
const signatures = Select(this.innerXml, ".//*[local-name(.)='Signature' and namespace-uri(.)='http://www.w3.org/2000/09/xmldsig#']");
for (let i = 0; i < signatures.length; i++) {
const signature = signatures[i];
if (signature.parentNode) {
signature.parentNode.removeChild(signature);
}
}
return this.innerXml;
} |
but I've got a problem with NodeJS version. XMLDOM module serializes a bad XML document. It doesn't add a namespace to the second Signature object Wrong XML<root>
<child/>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/>
<ds:Signature/>
</root> Correct XML<root>
<child/>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"/>
</root> |
@brunovianarezende Please check the latest version. I fixed the problem with multiple signatures. |
@microshine : is this correct? I'm reading the xmldsig document (https://www.w3.org/2000/02/xmldsig) and it says (https://www.w3.org/2000/02/xmldsig#def-SignatureEnveloped): "Obviously, enveloped signatures must take care not to include their own value in the calculation of the SignatureValue.", i.e. it doesn't talk about other enveloped signatures in the same document. Looking at https://www.w3.org/TR/xmldsig-core/#sec-EnvelopedSignature I see that the enveloped signature transform should use the xpath
to find out what must be removed, i.e. it will only remove itself from the document, not all the signature tags. |
I'm trying to use xadesjs to support multiple paralles signatures in a document. My use case is:
this would allow, for example, the users to remove their signatures from the document without the need to re-sign the document.
I've tried to use multiple enveloped signatures, but it hasn't worked: it seems like the enveloped signature transformation only removes a single enveloped signature fom the document before signing or validation process.
Then, I decided as a new approach to have the original document wrapped by other tag and then sign it by using xpath transforms, pointing to the original content. It would be something like:
But then it seems xadesjs doesn't support xpath transform. I've seen in PeculiarVentures/xmldsigjs#32 that xpath transform support was, in theory, added to xmldsigjs and as a consequence to xadesjs, but I couldn't make it work. First, I couldn't put anywhere the xpath I want to use. I changed the code and, for exploration purpose, I hard-coded the xpah I wanted to use, but it didn't work, it seems like the node-set returned by the xpath is just ignored.
is it possible to do what I want (parallel signature support using xpath or not) using xadesjs?
The text was updated successfully, but these errors were encountered: