Package org.apache.poi.poifs.crypt
Class Encryptor
- java.lang.Object
-
- org.apache.poi.poifs.crypt.Encryptor
-
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
AgileEncryptor
,BinaryRC4Encryptor
,CryptoAPIEncryptor
,StandardEncryptor
,XOREncryptor
public abstract class Encryptor extends java.lang.Object implements java.lang.Cloneable
-
-
Constructor Summary
Constructors Constructor Description Encryptor()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Encryptor
clone()
abstract void
confirmPassword(java.lang.String password)
abstract void
confirmPassword(java.lang.String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)
ChunkedCipherOutputStream
getDataStream(java.io.OutputStream stream, int initialOffset)
abstract java.io.OutputStream
getDataStream(DirectoryNode dir)
Return a output stream for encrypted data.java.io.OutputStream
getDataStream(POIFSFileSystem fs)
EncryptionInfo
getEncryptionInfo()
static Encryptor
getInstance(EncryptionInfo info)
javax.crypto.SecretKey
getSecretKey()
void
setChunkSize(int chunkSize)
Sets the chunk size of the data stream.void
setEncryptionInfo(EncryptionInfo encryptionInfo)
void
setSecretKey(javax.crypto.SecretKey secretKey)
-
-
-
Method Detail
-
getDataStream
public abstract java.io.OutputStream getDataStream(DirectoryNode dir) throws java.io.IOException, java.security.GeneralSecurityException
Return a output stream for encrypted data.- Parameters:
dir
- the node to write to- Returns:
- encrypted stream
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
confirmPassword
public abstract void confirmPassword(java.lang.String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)
-
confirmPassword
public abstract void confirmPassword(java.lang.String password)
-
getInstance
public static Encryptor getInstance(EncryptionInfo info)
-
getDataStream
public java.io.OutputStream getDataStream(POIFSFileSystem fs) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
getDataStream
public ChunkedCipherOutputStream getDataStream(java.io.OutputStream stream, int initialOffset) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
getSecretKey
public javax.crypto.SecretKey getSecretKey()
-
setSecretKey
public void setSecretKey(javax.crypto.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
-
clone
public Encryptor clone() throws java.lang.CloneNotSupportedException
- Throws:
java.lang.CloneNotSupportedException
-
-