-
Notifications
You must be signed in to change notification settings - Fork 66
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
Undefined method xpath for String #57
Comments
Nokogiri returns an XML string after canonicalization which makes sense as the order of the elements is then guaranteed. I'm not sure if it solves your case, but something that can be tried is to always do the canonicalization last, regardless of the order in the XML. That would have to be changed here: Not sure if you have time to create a PR for this? |
Hi @benoist thanks for the prompt reply. I think I might write a PR for this but as I mentioned I don't have too much experience with XML signing so I have some doubts about the signature (not the process of signing). Is the order of the canonicalization important? Does it affect the signature value? |
Canonicalization means that XML will be converted to a format based on rules. So anyone can create XML with attribute orders as they like, no order guarantee required. Canonicalization ensures all attributes are put in the correct order, whitespace is managed properly etc. Every byte before signing is significant. So yes order is also important. |
Hi, I'm having to sign an xml with the canonicalization as the first transformation:
However it seems that by applying that first canonicalization as the first transformation node, the
@node
variable from https://github.com/benoist/xmldsig/blob/master/lib/xmldsig/transforms.rb#L7 is converted from aNokogiri::XML::Element
to a regularString
which makes all the subsequent transformation to fail.Given my inexperience with signing xml I'm not sure if applying the canonicalization as the first transformation is a regular or correct use case or if it's just unsupported by the gem.
The text was updated successfully, but these errors were encountered: