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

Question about ApplyTransformers #75

Open
sla100 opened this issue Dec 3, 2022 · 0 comments
Open

Question about ApplyTransformers #75

sla100 opened this issue Dec 3, 2022 · 0 comments

Comments

@sla100
Copy link

sla100 commented Dec 3, 2022

I have doubts about this code:

xmldsigjs/src/signed_xml.ts

Lines 544 to 573 in 71e66d3

protected ApplyTransforms(transforms: XmlTransforms, input: Element): any {
let output: any = null;
transforms.Sort((a, b) => {
const c14nTransforms = [Transforms.XmlDsigC14NTransform, XmlDsigC14NWithCommentsTransform,
Transforms.XmlDsigExcC14NTransform, XmlDsigExcC14NWithCommentsTransform];
if (c14nTransforms.some((t) => a instanceof t)) {
return 1;
}
if (c14nTransforms.some((t) => b instanceof t)) {
return -1;
}
return 0;
}).ForEach((transform) => {
transform.LoadInnerXml(input);
if (transform instanceof Transforms.XmlDsigXPathTransform) {
transform.GetOutput();
} else {
output = transform.GetOutput();
}
});
// Apply C14N transform if Reference has only one transform EnvelopedSignature
if (transforms.Count === 1 && transforms.Item(0) instanceof Transforms.XmlDsigEnvelopedSignatureTransform) {
const c14n = new Transforms.XmlDsigC14NTransform();
c14n.LoadInnerXml(input);
output = c14n.GetOutput();
}
return output;
}

  1. Why there is "dummy" GetOutput call at 560?
  2. Why every transformer load initial xml (line 585) instead of the result returned by the predecessor? It look like only last transformer works.
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