diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/CertificateKeyEncryptor.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/CertificateKeyEncryptor.java index 938b04f466..706ec93f2e 100644 --- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/CertificateKeyEncryptor.java +++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/CertificateKeyEncryptor.java @@ -17,13 +17,12 @@ package org.apache.poi.poifs.crypt.agile; -import static org.apache.poi.poifs.crypt.agile.EncryptionDocument.getBinAttr; -import static org.apache.poi.poifs.crypt.agile.EncryptionDocument.setBinAttr; - import org.apache.poi.EncryptedDocumentException; import org.w3c.dom.Document; import org.w3c.dom.Element; +import static org.apache.poi.poifs.crypt.agile.EncryptionDocument.*; + public class CertificateKeyEncryptor { /** @@ -60,9 +59,9 @@ public class CertificateKeyEncryptor { void write(Element encryption) { Document doc = encryption.getOwnerDocument(); - Element keyEncryptor = (Element) encryption.appendChild(doc.createElement("keyEncryptor")); + Element keyEncryptor = (Element) encryption.appendChild(doc.createElementNS(ENC_NS, "keyEncryptor")); keyEncryptor.setAttribute("uri", KeyEncryptor.CERT_NS); - Element encryptedKey = (Element) keyEncryptor.appendChild(doc.createElement("c:encryptedKey")); + Element encryptedKey = (Element) keyEncryptor.appendChild(doc.createElementNS(KeyEncryptor.CERT_NS, "c:encryptedKey")); setBinAttr(encryptedKey, "encryptedKeyValue", encryptedKeyValue); setBinAttr(encryptedKey, "x509Certificate", x509Certificate); diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/DataIntegrity.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/DataIntegrity.java index 5d067b0232..37c90e4904 100644 --- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/DataIntegrity.java +++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/DataIntegrity.java @@ -59,7 +59,7 @@ public class DataIntegrity { void write(Element encryption) { Document doc = encryption.getOwnerDocument(); - Element dataIntegrity = (Element)encryption.appendChild(doc.createElement("dataIntegrity")); + Element dataIntegrity = (Element)encryption.appendChild(doc.createElementNS(ENC_NS, "dataIntegrity")); setBinAttr(dataIntegrity, "encryptedHmacKey", encryptedHmacKey); setBinAttr(dataIntegrity, "encryptedHmacValue", encryptedHmacValue); } diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/EncryptionDocument.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/EncryptionDocument.java index fd5e53a2b9..659507a574 100644 --- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/EncryptionDocument.java +++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/EncryptionDocument.java @@ -76,7 +76,7 @@ public class EncryptionDocument { if (dataIntegrity != null) { dataIntegrity.write(encryption); } - Element keyEncryptors = (Element)encryption.appendChild(doc.createElement("keyEncryptors")); + Element keyEncryptors = (Element)encryption.appendChild(doc.createElementNS(ENC_NS, "keyEncryptors")); boolean hasPass = false; boolean hasCert = false; for (KeyEncryptor ke : this.keyEncryptors) { diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java index fba57eb2c4..5ed0d14db3 100644 --- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java +++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java @@ -71,7 +71,7 @@ public class KeyData { void write(Element encryption) { Document doc = encryption.getOwnerDocument(); - Element keyData = (Element)encryption.appendChild(doc.createElement("keyData")); + Element keyData = (Element)encryption.appendChild(doc.createElementNS(ENC_NS, "keyData")); setIntAttr(keyData, "saltSize", saltSize); setIntAttr(keyData, "blockSize", blockSize); setIntAttr(keyData, "keyBits", keyBits); diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/PasswordKeyEncryptor.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/PasswordKeyEncryptor.java index 1e3f8640ff..c31caaba40 100644 --- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/PasswordKeyEncryptor.java +++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/PasswordKeyEncryptor.java @@ -17,12 +17,6 @@ package org.apache.poi.poifs.crypt.agile; -import static org.apache.poi.poifs.crypt.agile.EncryptionDocument.getBinAttr; -import static org.apache.poi.poifs.crypt.agile.EncryptionDocument.getIntAttr; -import static org.apache.poi.poifs.crypt.agile.EncryptionDocument.setAttr; -import static org.apache.poi.poifs.crypt.agile.EncryptionDocument.setBinAttr; -import static org.apache.poi.poifs.crypt.agile.EncryptionDocument.setIntAttr; - import org.apache.poi.EncryptedDocumentException; import org.apache.poi.poifs.crypt.ChainingMode; import org.apache.poi.poifs.crypt.CipherAlgorithm; @@ -30,6 +24,9 @@ import org.apache.poi.poifs.crypt.HashAlgorithm; import org.w3c.dom.Document; import org.w3c.dom.Element; +import static org.apache.poi.poifs.crypt.agile.EncryptionDocument.*; +import static org.apache.poi.poifs.crypt.agile.KeyEncryptor.PASS_NS; + public class PasswordKeyEncryptor { /** @@ -124,9 +121,9 @@ public class PasswordKeyEncryptor { void write(Element encryption) { Document doc = encryption.getOwnerDocument(); - Element keyEncryptor = (Element) encryption.appendChild(doc.createElement("keyEncryptor")); - keyEncryptor.setAttribute("uri", KeyEncryptor.PASS_NS); - Element encryptedKey = (Element) keyEncryptor.appendChild(doc.createElement("p:encryptedKey")); + Element keyEncryptor = (Element) encryption.appendChild(doc.createElementNS(ENC_NS, "keyEncryptor")); + keyEncryptor.setAttribute("uri", PASS_NS); + Element encryptedKey = (Element) keyEncryptor.appendChild(doc.createElementNS(PASS_NS, "p:encryptedKey")); setIntAttr(encryptedKey, "saltSize", saltSize); setIntAttr(encryptedKey, "blockSize", blockSize); diff --git a/poi/src/main/java9/module-info.class b/poi/src/main/java9/module-info.class index a27868cdf4..7ca4ecd882 100644 Binary files a/poi/src/main/java9/module-info.class and b/poi/src/main/java9/module-info.class differ