public class EncryptionInfo extends java.lang.Object implements GenericRecord
poi-ooxml
to be on the classpath to load
some EncryptionMode
s.getBuilder(EncryptionMode)
Modifier and Type | Field and Description |
---|---|
static BitField |
flagAES
A value that MUST be 1 if the protected content is an ECMA-376 document
ECMA-376.
|
static BitField |
flagCryptoAPI
A flag that specifies whether CryptoAPI RC4 or ECMA-376 encryption
ECMA-376 is used.
|
static BitField |
flagDocProps
A value that MUST be 0 if document properties are encrypted.
|
static BitField |
flagExternal
A value that MUST be 1 if extensible encryption is used.
|
Constructor and Description |
---|
EncryptionInfo(DirectoryNode dir)
Opens for decryption
|
EncryptionInfo(EncryptionInfo other) |
EncryptionInfo(EncryptionMode encryptionMode)
Prepares for encryption, using the given Encryption Mode, and
all other parameters as default.
|
EncryptionInfo(EncryptionMode encryptionMode,
CipherAlgorithm cipherAlgorithm,
HashAlgorithm hashAlgorithm,
int keyBits,
int blockSize,
ChainingMode chainingMode)
Constructs an EncryptionInfo from scratch
|
EncryptionInfo(LittleEndianInput dis,
EncryptionMode preferredEncryptionMode) |
EncryptionInfo(POIFSFileSystem fs)
Opens for decryption
|
Modifier and Type | Method and Description |
---|---|
EncryptionInfo |
copy() |
protected static EncryptionInfoBuilder |
getBuilder(EncryptionMode encryptionMode)
This method loads the builder class with reflection, which may generate
a
ClassNotFoundException if the class is not on the classpath. |
Decryptor |
getDecryptor() |
int |
getEncryptionFlags() |
EncryptionMode |
getEncryptionMode() |
Encryptor |
getEncryptor() |
java.util.Map<java.lang.String,java.util.function.Supplier<?>> |
getGenericProperties() |
EncryptionHeader |
getHeader() |
EncryptionVerifier |
getVerifier() |
int |
getVersionMajor() |
int |
getVersionMinor() |
boolean |
isDocPropsEncrypted() |
void |
setDecryptor(Decryptor decryptor) |
void |
setEncryptor(Encryptor encryptor) |
void |
setHeader(EncryptionHeader header) |
void |
setVerifier(EncryptionVerifier verifier) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getGenericChildren, getGenericRecordType
public static final BitField flagCryptoAPI
public static final BitField flagDocProps
public static final BitField flagExternal
public static final BitField flagAES
public EncryptionInfo(POIFSFileSystem fs) throws java.io.IOException
java.io.IOException
public EncryptionInfo(DirectoryNode dir) throws java.io.IOException
java.io.IOException
public EncryptionInfo(LittleEndianInput dis, EncryptionMode preferredEncryptionMode) throws java.io.IOException
java.io.IOException
public EncryptionInfo(EncryptionMode encryptionMode)
public EncryptionInfo(EncryptionMode encryptionMode, CipherAlgorithm cipherAlgorithm, HashAlgorithm hashAlgorithm, int keyBits, int blockSize, ChainingMode chainingMode)
encryptionMode
- see EncryptionMode
for values, EncryptionMode.cryptoAPI
is for
internal use only, as it's record basedcipherAlgorithm
- the cipher algorithmhashAlgorithm
- the hash algorithmkeyBits
- the bit count of the keyblockSize
- the size of a cipher blockchainingMode
- the chaining modeEncryptedDocumentException
- if the given parameters mismatch, e.g. only certain combinations
of keyBits, blockSize are allowed for a given CipherAlgorithm
public EncryptionInfo(EncryptionInfo other)
protected static EncryptionInfoBuilder getBuilder(EncryptionMode encryptionMode) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException
ClassNotFoundException
if the class is not on the classpath.
For example, AgileEncryptionInfoBuilder
is contained in the poi-ooxml
package since the class makes use of some OOXML
classes rather than using the poi
package and plain XML DOM calls.
As such, you may need to include poi-ooxml
and poi-ooxml-schemas
to load
some encryption mode builders. See bug #60021 for more information.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60021encryptionMode
- the encryption modejava.lang.ClassNotFoundException
- if the builder class is not on the classpathjava.lang.IllegalAccessException
- if the builder class can't be loadedjava.lang.InstantiationException
- if the builder class can't be loadedpublic int getVersionMajor()
public int getVersionMinor()
public int getEncryptionFlags()
public EncryptionHeader getHeader()
public EncryptionVerifier getVerifier()
public Decryptor getDecryptor()
public Encryptor getEncryptor()
public void setHeader(EncryptionHeader header)
public void setVerifier(EncryptionVerifier verifier)
public void setDecryptor(Decryptor decryptor)
public void setEncryptor(Encryptor encryptor)
public EncryptionMode getEncryptionMode()
public boolean isDocPropsEncrypted()
EncryptedStream
stream,
otherwise the Summaries aren't encrypted and located in their usual streamspublic EncryptionInfo copy()
public java.util.Map<java.lang.String,java.util.function.Supplier<?>> getGenericProperties()
getGenericProperties
in interface GenericRecord
Copyright 2020 The Apache Software Foundation or its licensors, as applicable.