public class CryptoAPIDecryptor extends Decryptor
builder, DEFAULT_PASSWORD, DEFAULT_POIFS_ENTRY| Modifier | Constructor and Description |
|---|---|
protected |
CryptoAPIDecryptor(CryptoAPIEncryptionInfoBuilder builder) |
| Modifier and Type | Method and Description |
|---|---|
protected static SecretKey |
generateSecretKey(String password,
EncryptionVerifier ver) |
InputStream |
getDataStream(DirectoryNode dir)
Decrypt the Document-/SummaryInformation and other optionally streams.
|
long |
getLength()
Returns the length of the encrypted data that can be safely read with
Decryptor.getDataStream(org.docx4j.org.apache.poi.poifs.filesystem.DirectoryNode). |
Cipher |
initCipherForBlock(Cipher cipher,
int block)
Initializes a cipher object for a given block index for decryption
|
protected static Cipher |
initCipherForBlock(Cipher cipher,
int block,
EncryptionInfoBuilder builder,
SecretKey skey,
int encryptMode) |
boolean |
verifyPassword(String password) |
getBlockSizeInBytes, getDataStream, getDataStream, getDataStream, getInstance, getIntegrityHmacKey, getIntegrityHmacValue, getKeySizeInBytes, getSecretKey, getVerifier, setIntegrityHmacKey, setIntegrityHmacValue, setSecretKey, setVerifierprotected CryptoAPIDecryptor(CryptoAPIEncryptionInfoBuilder builder)
public boolean verifyPassword(String password)
verifyPassword in class Decryptorpublic Cipher initCipherForBlock(Cipher cipher, int block) throws GeneralSecurityException
cipher - may be null, otherwise the given instance is reset to the new block indexblock - the block index, e.g. the persist/slide id (hslf)GeneralSecurityExceptionprotected static Cipher initCipherForBlock(Cipher cipher, int block, EncryptionInfoBuilder builder, SecretKey skey, int encryptMode) throws GeneralSecurityException
GeneralSecurityExceptionprotected static SecretKey generateSecretKey(String password, EncryptionVerifier ver)
public InputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException
getDataStream in class Decryptordir - the node to read fromIOExceptionGeneralSecurityExceptionpublic long getLength()
DecryptorDecryptor.getDataStream(org.docx4j.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.docx4j.org.apache.poi.poifs.filesystem.DirectoryNode),
an attempt to call getLength() prior to getDataStream() will result in IllegalStateException.
getLength in class DecryptorgetDataStream(DirectoryNode)Copyright © 2007-2020. All Rights Reserved.