Class AgileEncryptor.AgileCipherOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.docx4j.org.apache.poi.poifs.crypt.ChunkedCipherOutputStream
org.docx4j.org.apache.poi.poifs.crypt.agile.AgileEncryptor.AgileCipherOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
- Enclosing class:
- AgileEncryptor
2.3.4.15 Data Encryption (Agile Encryption)
The EncryptedPackage stream (1) MUST be encrypted in 4096-byte segments to facilitate nearly
random access while allowing CBC modes to be used in the encryption process.
The initialization vector for the encryption process MUST be obtained by using the zero-based
segment number as a blockKey and the binary form of the KeyData.saltValue as specified in
section 2.3.4.12. The block number MUST be represented as a 32-bit unsigned integer.
Data blocks MUST then be encrypted by using the initialization vector and the intermediate key
obtained by decrypting the encryptedKeyValue from a KeyEncryptor contained within the
KeyEncryptors sequence as specified in section 2.3.4.10. The final data block MUST be padded to
the next integral multiple of the KeyData.blockSize value. Any padding bytes can be used. Note
that the StreamSize field of the EncryptedPackage field specifies the number of bytes of
unencrypted data as specified in section 2.3.4.4.
-
Field Summary
Fields inherited from class org.docx4j.org.apache.poi.poifs.crypt.ChunkedCipherOutputStream
chunkBits, chunkMask, chunkSizeFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculateChecksum(File fileOut, int oleStreamSize) protected voidcreateEncryptionInfoEntry(DirectoryNode dir, File tmpFile) protected CipherinitCipherForBlock(Cipher existing, int block, boolean lastChunk) Methods inherited from class org.docx4j.org.apache.poi.poifs.crypt.ChunkedCipherOutputStream
close, write, write, write, writeChunkMethods inherited from class java.io.FilterOutputStream
flushMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
AgileCipherOutputStream
- Throws:
IOExceptionGeneralSecurityException
-
-
Method Details
-
initCipherForBlock
protected Cipher initCipherForBlock(Cipher existing, int block, boolean lastChunk) throws GeneralSecurityException - Specified by:
initCipherForBlockin classChunkedCipherOutputStream- Throws:
GeneralSecurityException
-
calculateChecksum
protected void calculateChecksum(File fileOut, int oleStreamSize) throws GeneralSecurityException, IOException - Specified by:
calculateChecksumin classChunkedCipherOutputStream- Throws:
GeneralSecurityExceptionIOException
-
createEncryptionInfoEntry
protected void createEncryptionInfoEntry(DirectoryNode dir, File tmpFile) throws IOException, GeneralSecurityException - Specified by:
createEncryptionInfoEntryin classChunkedCipherOutputStream- Throws:
IOExceptionGeneralSecurityException
-