]> source.dussan.org Git - poi.git/commitdiff
The default for standard encryption cipher algorithm was wrongly set to rc4
authorAndreas Beeker <kiwiwings@apache.org>
Mon, 26 Jan 2015 00:02:20 +0000 (00:02 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Mon, 26 Jan 2015 00:02:20 +0000 (00:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1654716 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionInfoBuilder.java

index 0a9b569cd4ee6e462009cd23d573e20493455444..43dc5695110fd3db4c9d155930ddedf2b6fc9e4b 100644 (file)
@@ -57,8 +57,14 @@ public class StandardEncryptionInfoBuilder implements EncryptionInfoBuilder {
         this.info = info;\r
 \r
         if (cipherAlgorithm == null) {\r
-            cipherAlgorithm = CipherAlgorithm.rc4;\r
+            cipherAlgorithm = CipherAlgorithm.aes128;\r
         }\r
+        if (cipherAlgorithm != CipherAlgorithm.aes128 &&\r
+            cipherAlgorithm != CipherAlgorithm.aes192 &&\r
+            cipherAlgorithm != CipherAlgorithm.aes256) {\r
+            throw new EncryptedDocumentException("Standard encryption only supports AES128/192/256.");\r
+        }\r
+        \r
         if (hashAlgorithm == null) {\r
             hashAlgorithm = HashAlgorithm.sha1;\r
         }\r