diff options
Diffstat (limited to 'src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java')
-rw-r--r-- | src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java b/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java index e8895c1abf..c70105fb93 100644 --- a/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java +++ b/src/java/org/apache/poi/poifs/crypt/EncryptionInfo.java @@ -122,8 +122,11 @@ public class EncryptionInfo implements Cloneable { } else if ( 2 <= versionMajor && versionMajor <= 4 && versionMinor == 2) { - encryptionMode = (preferredEncryptionMode == cryptoAPI) ? cryptoAPI : standard; encryptionFlags = dis.readInt(); + encryptionMode = ( + preferredEncryptionMode == cryptoAPI + || !flagAES.isSet(encryptionFlags)) + ? cryptoAPI : standard; } else if ( versionMajor == agile.versionMajor && versionMinor == agile.versionMinor){ @@ -268,6 +271,14 @@ public class EncryptionInfo implements Cloneable { return encryptionMode; } + /** + * @return true, if Document Summary / Summary are encrypted and stored in the {@code EncryptedStream} stream, + * otherwise the Summaries aren't encrypted and located in their usual streams + */ + public boolean isDocPropsEncrypted() { + return !flagDocProps.isSet(getEncryptionFlags()); + } + @Override public EncryptionInfo clone() throws CloneNotSupportedException { EncryptionInfo other = (EncryptionInfo)super.clone(); |