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 Encryptorclone()abstract voidconfirmPassword(java.lang.String password)abstract voidconfirmPassword(java.lang.String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)ChunkedCipherOutputStreamgetDataStream(java.io.OutputStream stream, int initialOffset)abstract java.io.OutputStreamgetDataStream(DirectoryNode dir)Return a output stream for encrypted data.java.io.OutputStreamgetDataStream(POIFSFileSystem fs)EncryptionInfogetEncryptionInfo()static EncryptorgetInstance(EncryptionInfo info)javax.crypto.SecretKeygetSecretKey()voidsetChunkSize(int chunkSize)Sets the chunk size of the data stream.voidsetEncryptionInfo(EncryptionInfo encryptionInfo)voidsetSecretKey(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.IOExceptionjava.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.IOExceptionjava.security.GeneralSecurityException
-
getDataStream
public ChunkedCipherOutputStream getDataStream(java.io.OutputStream stream, int initialOffset) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOExceptionjava.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
-
-