|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.poi.poifs.crypt.Decryptor
org.apache.poi.poifs.crypt.xor.XORDecryptor
public class XORDecryptor
| Field Summary |
|---|
| Fields inherited from class org.apache.poi.poifs.crypt.Decryptor |
|---|
DEFAULT_PASSWORD, DEFAULT_POIFS_ENTRY, encryptionInfo |
| Constructor Summary | |
|---|---|
protected |
XORDecryptor()
|
| Method Summary | |
|---|---|
XORDecryptor |
clone()
|
ChunkedCipherInputStream |
getDataStream(DirectoryNode dir)
Return a stream with decrypted data. |
java.io.InputStream |
getDataStream(java.io.InputStream stream,
int size,
int initialPos)
Wraps a stream for decryption |
long |
getLength()
Returns the length of the encrypted data that can be safely read with Decryptor.getDataStream(org.apache.poi.poifs.filesystem.DirectoryNode). |
javax.crypto.Cipher |
initCipherForBlock(javax.crypto.Cipher cipher,
int block)
Initializes a cipher object for a given block index for encryption |
protected static javax.crypto.Cipher |
initCipherForBlock(javax.crypto.Cipher cipher,
int block,
EncryptionInfo encryptionInfo,
javax.crypto.SecretKey skey,
int encryptMode)
|
void |
setChunkSize(int chunkSize)
Sets the chunk size of the data stream. |
boolean |
verifyPassword(java.lang.String password)
|
| Methods inherited from class org.apache.poi.poifs.crypt.Decryptor |
|---|
getBlockSizeInBytes, getDataStream, getDataStream, getDataStream, getEncryptionInfo, getInstance, getIntegrityHmacKey, getIntegrityHmacValue, getKeySizeInBytes, getSecretKey, getVerifier, setEncryptionInfo, setIntegrityHmacKey, setIntegrityHmacValue, setSecretKey, setVerifier |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected XORDecryptor()
| Method Detail |
|---|
public boolean verifyPassword(java.lang.String password)
verifyPassword in class Decryptor
public javax.crypto.Cipher initCipherForBlock(javax.crypto.Cipher cipher,
int block)
throws java.security.GeneralSecurityException
Decryptor
initCipherForBlock in class Decryptorcipher - may be null, otherwise the given instance is reset to the new block indexblock - the block index, e.g. the persist/slide id (hslf)
java.security.GeneralSecurityException
protected static javax.crypto.Cipher initCipherForBlock(javax.crypto.Cipher cipher,
int block,
EncryptionInfo encryptionInfo,
javax.crypto.SecretKey skey,
int encryptMode)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityException
public ChunkedCipherInputStream getDataStream(DirectoryNode dir)
throws java.io.IOException,
java.security.GeneralSecurityException
Decryptor
Use Decryptor.getLength() to get the size of that data that can be safely read from the stream.
Just reading to the end of the input stream is not sufficient because there are
normally padding bytes that must be discarded
getDataStream in class Decryptordir - the node to read from
java.io.IOException
java.security.GeneralSecurityException
public java.io.InputStream getDataStream(java.io.InputStream stream,
int size,
int initialPos)
throws java.io.IOException,
java.security.GeneralSecurityException
DecryptorAs we are handling streams and don't know the total length beforehand, it's the callers duty to care for the length of the entries.
getDataStream in class Decryptorstream - the stream to be wrappedinitialPos - initial/current byte position within the stream
java.io.IOException
java.security.GeneralSecurityExceptionpublic long getLength()
DecryptorDecryptor.getDataStream(org.apache.poi.poifs.filesystem.DirectoryNode).
Just reading to the end of the input stream is not sufficient because there are
normally padding bytes that must be discarded
The length variable is initialized in Decryptor.getDataStream(org.apache.poi.poifs.filesystem.DirectoryNode),
an attempt to call getLength() prior to getDataStream() will result in IllegalStateException.
getLength in class Decryptorpublic void setChunkSize(int chunkSize)
Decryptor
setChunkSize in class DecryptorchunkSize - the chunk size, i.e. the block size with the same encryption key
public XORDecryptor clone()
throws java.lang.CloneNotSupportedException
clone in class Decryptorjava.lang.CloneNotSupportedException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||