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
This commit is contained in:
Andreas Beeker 2015-01-26 00:02:20 +00:00
parent 0bd3a6df26
commit 3d97978cee
1 changed files with 7 additions and 1 deletions

View File

@ -57,8 +57,14 @@ public class StandardEncryptionInfoBuilder implements EncryptionInfoBuilder {
this.info = info; this.info = info;
if (cipherAlgorithm == null) { 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) { if (hashAlgorithm == null) {
hashAlgorithm = HashAlgorithm.sha1; hashAlgorithm = HashAlgorithm.sha1;
} }