Fixed an obscure bug in which certificates may not be found. #104
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I did not write up a test case, but I did have to change this in my own implementation,
and it fixed the bug. If you'd like, I will attempt to write an actual test case.
This also more closely mimics the tests in xml-crypt, as shown here.
Not sure if anyone else has run into this issue, but I did in a separate project.
The issue is that when the signature node has been serialized to a String,
it loses the context of where it is in the XML tree. When deserialized, it
only knows about itself. Later in the code, in valdiateSignatureValue of xml-crypto,
this is called:
var signedInfo = utils.findChilds(this.signatureNode, "SignedInfo")
However, if the signature node has been serialized and deserialized, it
incorrectly reports it only has 1 child (itself), as opposed to the correct number.
This causes the certificate data to not be found, and the validation to fail.
All tests still pass with this change. Update to xml-crypto required.