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

Difference from javax.xml.crypto.dsig and xml-crypto signature value #486

Open
sibelius opened this issue Feb 4, 2025 · 1 comment
Open

Comments

@sibelius
Copy link

sibelius commented Feb 4, 2025

This is the SignedInfo canonilized

<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"></ds:SignatureMethod><ds:Reference URI="key-info-id"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></ds:DigestMethod><ds:DigestValue>aUK42Eje/aj9EEEZn1wHoSsQMnPW0J8GpDP124YLE1w=</ds:DigestValue></ds:Reference><ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></ds:DigestMethod><ds:DigestValue>3lnGNn7gACFoylCvc8RXyyg3etLlVjfuxHYcOZhTL+c=</ds:DigestValue></ds:Reference><ds:Reference><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"></ds:DigestMethod><ds:DigestValue>aIc0+7BXP+Ee09zng0JE21rkzgVlYaa6qMGHIBQKvTc=</ds:DigestValue></ds:Reference></ds:SignedInfo>

it generates this hash in node

QOyatmgHiGguYkBeNFUJU3b/448S7BnkNA79II01aBrsoP0AlKXAc6wAxh5B9vIRddQrMkOAiC6o8qGF2NVDd7dyNZZ5PeHyMnV88c+MbX4v68w+uVaK4nG2fFucA6Uyvl2UciohGW9bcRk3O6ImF/0tIxyuiZETEYDAd5VYTcLvWgFS2yDMFF+8FadhcFaBB4y79++YK4fCgbyUzgywfoozr+5Q7vyVxVXbhD+rb5e74v/Jg/nkS0fUmQWT2WFt9ZeSYAc/+HgMT3zlADnP6DJHgoPd/Ptmz2SnaUnolAzhFOPFL9zDG0EfWfGBJekjts/EKuq4qC6mCfwdtF/mng==

and it generates this hash in java/kotlin

XQJ8s0LlWL75DwXJ3LPZy6e8JOvkq6ccpQssQVIkr66CWGfgz2WVC0qz6s7duHhbSZxicpgYGQME&#xD;
cwAfrX4rNAEpI3+NcIS7c2Mue2X3BNovfk6mBzB5bSci4bVwB2vWK0lErnjPXHAviYq2lM6YdV50&#xD;
V6hiNwLNIqsLsv7k4ECkY9H0aD693K7yc1n3KT3jrEtql4uouOZbpV1LbFr+vWs0A6aMbJOm7zFz&#xD;
f26gBtgjDlqRIEBgyItG+O4EBKV4DCcxPXvAS4Qx/RXiIz2wUH6EcXvdw40+VmgwgBkWHvCkCQKM&#xD;
KIjEgqyv5jv8pIlPYdttYJq3Ip+vL03Sbtkb5A==

do you have an idea why java signature has #xD;\n ?

@srd90
Copy link

srd90 commented Feb 4, 2025

do you have an idea why java signature has #xD;\n ?

Yes. At least I have an idea. Dunno about others.

BTW. You considered this to be a bug at xml-crypto due to reporting bug issue instead of discussion post.

Whats your xml-crypto version and node version and steps to reproduce bug.

(What was your exact JDK version)

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

2 participants