aboutsummaryrefslogtreecommitdiffstats
path: root/poi/src
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-11-24 17:00:08 +0000
committerPJ Fanning <fanningpj@apache.org>2021-11-24 17:00:08 +0000
commit9cd858c393ff97c8a13848c379590d0ce9048888 (patch)
tree47f2a09427e8ada82ba325440b2b9a1d2abd467c /poi/src
parentf661e7c5a0d405e2d0d595b50b86e3b93335f2c9 (diff)
downloadpoi-9cd858c393ff97c8a13848c379590d0ce9048888.tar.gz
poi-9cd858c393ff97c8a13848c379590d0ce9048888.zip
[bug-65701] use createElementNS in agile encyption writer code
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895303 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src')
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/agile/CertificateKeyEncryptor.java9
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/agile/DataIntegrity.java2
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/agile/EncryptionDocument.java2
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java2
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/agile/PasswordKeyEncryptor.java15
-rw-r--r--poi/src/main/java9/module-info.classbin3385 -> 3421 bytes
6 files changed, 13 insertions, 17 deletions
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
--- a/poi/src/main/java9/module-info.class
+++ b/poi/src/main/java9/module-info.class
Binary files differ