You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Ricardo Martin (Jira)" <ji...@apache.org> on 2025/10/17 07:15:00 UTC
[jira] [Created] (SANTUARIO-629) Canonizalization incorrect after ECDH-ES encryption
Ricardo Martin created SANTUARIO-629:
----------------------------------------
Summary: Canonizalization incorrect after ECDH-ES encryption
Key: SANTUARIO-629
URL: https://issues.apache.org/jira/browse/SANTUARIO-629
Project: Santuario
Issue Type: Bug
Components: Java
Affects Versions: Java 3.0.6, Java 4.0.4
Reporter: Ricardo Martin
Assignee: Colm O hEigeartaigh
When you encrypt a document using ECDH-ES introduced in issue SANTUARIO-511, the resulting doc is incorrectly canonicalized. This way, when the doc is first encrypted and then signed (using the same doc in the process), the signature is not calculated OK and when the document is transported (via network or file) cannot be verified correctly. The reason is the canonicalization is different and the signature is never computed with the same result.
The main issue is the new enc11 elements are created without specifying the general xmlns namespace. For example [here|https://github.com/apache/santuario-xml-security-java/blob/xmlsec-4.0.4/src/main/java/org/apache/xml/security/utils/Encryption11ElementProxy.java#L46]. The xmlns attribute should be included with namespace like for example in the [KeyInfo|https://github.com/apache/santuario-xml-security-java/blob/xmlsec-4.0.4/src/main/java/org/apache/xml/security/keys/KeyInfo.java#L119]. With the current addition without namespace, the attribute is OK when exported to file or string but for canonicalization is not OK because it's not detected as a namespace and therefore the attribute is maintained.
I'm going to send a PR asap because the fix is easy. The current workaround is just re-creating the doc after encryption and before the signature. For example export to string and initializing a new doc again from the string.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)