aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/poifs
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2013-12-25 01:04:29 +0000
committerAndreas Beeker <kiwiwings@apache.org>2013-12-25 01:04:29 +0000
commit31458eb486649e2f8b6bff6803043dffd903613c (patch)
treec7540a7b95ff0f77b1141e28a40f8a07ab0a8e71 /src/java/org/apache/poi/poifs
parentb282bd7f9c507befd19ac98444f8711765e7ae83 (diff)
downloadpoi-31458eb486649e2f8b6bff6803043dffd903613c.tar.gz
poi-31458eb486649e2f8b6bff6803043dffd903613c.zip
JCE policy fix
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1553342 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/poifs')
-rw-r--r--src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java b/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
index 33876fc975..42ca434198 100644
--- a/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
+++ b/src/java/org/apache/poi/poifs/crypt/CryptoFunctions.java
@@ -22,12 +22,14 @@ import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.security.Provider;
import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
import java.util.Arrays;
import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.SecretKey;
import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.RC2ParameterSpec;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.util.LittleEndian;
@@ -188,8 +190,13 @@ public class CryptoFunctions {
if (vec == null) {
cipher.init(cipherMode, key);
} else {
- IvParameterSpec iv = new IvParameterSpec(vec);
- cipher.init(cipherMode, key, iv);
+ AlgorithmParameterSpec aps;
+ if (cipherAlgorithm == CipherAlgorithm.rc2) {
+ aps = new RC2ParameterSpec(key.getEncoded().length*8, vec);
+ } else {
+ aps = new IvParameterSpec(vec);
+ }
+ cipher.init(cipherMode, key, aps);
}
return cipher;
} catch (GeneralSecurityException e) {