Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public Encryption11ElementProxy(Document doc) {
setElement(XMLUtils.createElementInEncryption11Space(doc, this.getBaseLocalName()));
String prefix = ElementProxy.getDefaultPrefix(this.getBaseNamespace());
if (prefix != null && prefix.length() > 0) {
getElement().setAttribute("xmlns:" + prefix, this.getBaseNamespace());
getElement().setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix, this.getBaseNamespace());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public EncryptionElementProxy(Document doc) {
setElement(XMLUtils.createElementInEncryptionSpace(doc, this.getBaseLocalName()));
String prefix = ElementProxy.getDefaultPrefix(this.getBaseNamespace());
if (prefix != null && !prefix.isEmpty()) {
getElement().setAttribute("xmlns:" + prefix, this.getBaseNamespace());
getElement().setAttributeNS(Constants.NamespaceSpecNS, "xmlns:" + prefix, this.getBaseNamespace());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,12 @@ void testAgreementKeyEncryptDecryptDocument(String w3cTag,
Files.write(Path.of("target","test-enc-"+w3cTag+".xml"), toString(doc.getFirstChild()).getBytes());
// XMLUtils.outputDOM(doc.getFirstChild(), System.out);

// re-read the document and compare both are the same after canonicalization
Document doc2 = XMLUtils.read(
new ByteArrayInputStream(toString(doc.getFirstChild()).getBytes(java.nio.charset.StandardCharsets.UTF_8)),
false);
assertEquals(toString(doc.getFirstChild()), toString(doc2.getFirstChild()));

// Perform decryption
Document dd = decryptElement(doc, ecKey, (X509Certificate)cert);
// XMLUtils.outputDOM(dd.getFirstChild(), System.out);
Expand Down