From: Andreas Beeker Date: Mon, 26 Jan 2015 00:02:20 +0000 (+0000) Subject: The default for standard encryption cipher algorithm was wrongly set to rc4 X-Git-Tag: REL_3_12_BETA1~20 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3d97978cee8a12cbe513f5e72f7f986690af33fe;p=poi.git The default for standard encryption cipher algorithm was wrongly set to rc4 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1654716 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionInfoBuilder.java b/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionInfoBuilder.java index 0a9b569cd4..43dc569511 100644 --- a/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionInfoBuilder.java +++ b/src/java/org/apache/poi/poifs/crypt/standard/StandardEncryptionInfoBuilder.java @@ -57,8 +57,14 @@ public class StandardEncryptionInfoBuilder implements EncryptionInfoBuilder { this.info = info; if (cipherAlgorithm == null) { - cipherAlgorithm = CipherAlgorithm.rc4; + cipherAlgorithm = CipherAlgorithm.aes128; } + if (cipherAlgorithm != CipherAlgorithm.aes128 && + cipherAlgorithm != CipherAlgorithm.aes192 && + cipherAlgorithm != CipherAlgorithm.aes256) { + throw new EncryptedDocumentException("Standard encryption only supports AES128/192/256."); + } + if (hashAlgorithm == null) { hashAlgorithm = HashAlgorithm.sha1; }