aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2016-11-01 09:18:55 +0000
committerAndreas Beeker <kiwiwings@apache.org>2016-11-01 09:18:55 +0000
commitce4596bbe744463c1fab732410bcf8be30dbe4b3 (patch)
treefcbfb816744be2034e8555d6abb135ebf06e71a5 /src
parentff6f6bb7c4745add4983629598891d0f68afa3f6 (diff)
downloadpoi-ce4596bbe744463c1fab732410bcf8be30dbe4b3.tar.gz
poi-ce4596bbe744463c1fab732410bcf8be30dbe4b3.zip
JCE policy assumption fix
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1767456 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java6
-rw-r--r--src/ooxml/testcases/org/apache/poi/poifs/crypt/TestEncryptor.java3
2 files changed, 9 insertions, 0 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java
index 19dc34b84e..e17e2dcb81 100644
--- a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java
+++ b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestDecryptor.java
@@ -29,12 +29,15 @@ import java.security.GeneralSecurityException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import javax.crypto.Cipher;
+
import org.apache.poi.POIDataSamples;
import org.apache.poi.poifs.filesystem.DirectoryNode;
import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.XSSFTestDataSamples;
+import org.junit.Assume;
import org.junit.Test;
public class TestDecryptor {
@@ -161,6 +164,9 @@ public class TestDecryptor {
@Test
public void bug60320() throws IOException, GeneralSecurityException {
+ int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
+ Assume.assumeTrue("Please install JCE Unlimited Strength Jurisdiction Policy files for AES 256", maxKeyLen == 2147483647);
+
InputStream is = POIDataSamples.getPOIFSInstance().openResourceAsStream("60320-protected.xlsx");
POIFSFileSystem fs = new POIFSFileSystem(is);
is.close();
diff --git a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestEncryptor.java b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestEncryptor.java
index f3e6c97e4c..4a411cc3d9 100644
--- a/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestEncryptor.java
+++ b/src/ooxml/testcases/org/apache/poi/poifs/crypt/TestEncryptor.java
@@ -394,6 +394,9 @@ public class TestEncryptor {
*/
@Test
public void bug60320CustomEncrypt() throws Exception {
+ int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES");
+ Assume.assumeTrue("Please install JCE Unlimited Strength Jurisdiction Policy files for AES 256", maxKeyLen == 2147483647);
+
// --- src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java (revision 1766745)
// +++ src/java/org/apache/poi/poifs/crypt/ChunkedCipherOutputStream.java (working copy)
// @@ -208,6 +208,13 @@