Package org.apache.poi.poifs.crypt
Class Encryptor
- java.lang.Object
-
- org.apache.poi.poifs.crypt.Encryptor
-
- All Implemented Interfaces:
GenericRecord
- Direct Known Subclasses:
AgileEncryptor
,BinaryRC4Encryptor
,CryptoAPIEncryptor
,StandardEncryptor
,XOREncryptor
public abstract class Encryptor extends Object implements GenericRecord
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
DEFAULT_POIFS_ENTRY
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
confirmPassword(String password)
abstract void
confirmPassword(String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)
abstract Encryptor
copy()
ChunkedCipherOutputStream
getDataStream(OutputStream stream, int initialOffset)
abstract OutputStream
getDataStream(DirectoryNode dir)
Return an output stream for encrypted data.OutputStream
getDataStream(POIFSFileSystem fs)
EncryptionInfo
getEncryptionInfo()
Map<String,Supplier<?>>
getGenericProperties()
static Encryptor
getInstance(EncryptionInfo info)
SecretKey
getSecretKey()
void
setChunkSize(int chunkSize)
Sets the chunk size of the data stream.void
setEncryptionInfo(EncryptionInfo encryptionInfo)
void
setSecretKey(SecretKey secretKey)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.poi.common.usermodel.GenericRecord
getGenericChildren, getGenericRecordType
-
-
-
-
Field Detail
-
DEFAULT_POIFS_ENTRY
protected static final String DEFAULT_POIFS_ENTRY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Encryptor
protected Encryptor()
-
Encryptor
protected Encryptor(Encryptor other)
-
-
Method Detail
-
getDataStream
public abstract OutputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException
Return an output stream for encrypted data.- Parameters:
dir
- the node to write to- Returns:
- encrypted stream
- Throws:
IOException
GeneralSecurityException
-
confirmPassword
public abstract void confirmPassword(String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)
-
confirmPassword
public abstract void confirmPassword(String password)
-
getInstance
public static Encryptor getInstance(EncryptionInfo info)
-
getDataStream
public OutputStream getDataStream(POIFSFileSystem fs) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
getDataStream
public ChunkedCipherOutputStream getDataStream(OutputStream stream, int initialOffset) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
getSecretKey
public SecretKey getSecretKey()
-
setSecretKey
public void setSecretKey(SecretKey secretKey)
-
getEncryptionInfo
public EncryptionInfo getEncryptionInfo()
-
setEncryptionInfo
public void setEncryptionInfo(EncryptionInfo encryptionInfo)
-
setChunkSize
public void setChunkSize(int chunkSize)
Sets the chunk size of the data stream. Needs to be set before the data stream is requested. When not set, the implementation uses method specific default values- Parameters:
chunkSize
- the chunk size, i.e. the block size with the same encryption key
-
copy
public abstract Encryptor copy()
-
getGenericProperties
public Map<String,Supplier<?>> getGenericProperties()
- Specified by:
getGenericProperties
in interfaceGenericRecord
-
-