Top Inners Fields Constructors Methods
org.apache.poi.poifs.crypt.agile

public Class AgileEncryptor

extends Encryptor
Class Inheritance
Static Imports
org.apache.poi.poifs.crypt.CryptoFunctions.getBlock0, .CryptoFunctions.getCipher, .CryptoFunctions.getMessageDigest, .CryptoFunctions.hashPassword, .DataSpaceMapUtils.createEncryptionEntry, .EncryptionInfo.ENCRYPTION_INFO_ENTRY, org.apache.poi.poifs.crypt.agile.AgileDecryptor.getNextBlockSize, .AgileDecryptor.hashInput, .AgileDecryptor.kCryptoKeyBlock, .AgileDecryptor.kHashedVerifierBlock, .AgileDecryptor.kIntegrityKeyBlock, .AgileDecryptor.kIntegrityValueBlock, .AgileDecryptor.kVerifierInputBlock

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
AgileEncryptor.AgileCipherOutputStream

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.

Field Summary

Modifier and TypeField and Description
private byte[]
private byte[]
Inherited from org.apache.poi.poifs.crypt.Encryptor:
DEFAULT_POIFS_ENTRY

Constructor Summary

AccessConstructor and Description
protected
protected

Method Summary

Modifier and TypeMethod and Description
public void
public void
confirmPassword(String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)

Implements abstract org.apache.poi.poifs.crypt.Encryptor.confirmPassword.

public AgileEncryptor
protected EncryptionDocument
public OutputStream
getDataStream(DirectoryNode
the node to write to
dir
)

Implements abstract org.apache.poi.poifs.crypt.Encryptor.getDataStream.

Return an output stream for encrypted data.

protected void
protected void
updateIntegrityHMAC(File tmpFile, int oleStreamSize)

Generate an HMAC, as specified in [RFC2104], of the encrypted form of the data (message), which the DataIntegrity element will verify by using the Salt generated in step 2 as the key.

Inherited from org.apache.poi.poifs.crypt.Encryptor:
getDataStreamgetDataStreamgetEncryptionInfogetGenericPropertiesgetInstancegetSecretKeysetChunkSizesetEncryptionInfosetSecretKey

Field Detail

integritySaltback to summary
private byte[] integritySalt
pwHashback to summary
private byte[] pwHash

Constructor Detail

AgileEncryptorback to summary
protected AgileEncryptor()
AgileEncryptorback to summary
protected AgileEncryptor(AgileEncryptor other)

Method Detail

confirmPasswordback to summary
public void confirmPassword(String password)

Implements abstract org.apache.poi.poifs.crypt.Encryptor.confirmPassword.

Annotations
@Override
confirmPasswordback to summary
public void confirmPassword(String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)

Implements abstract org.apache.poi.poifs.crypt.Encryptor.confirmPassword.

Annotations
@Override
copyback to summary
public AgileEncryptor copy()

Implements abstract org.apache.poi.poifs.crypt.Encryptor.copy.

Annotations
@Override
createEncryptionDocumentback to summary
protected EncryptionDocument createEncryptionDocument()
getDataStreamback to summary
public OutputStream getDataStream(DirectoryNode dir) throws IOException, GeneralSecurityException

Implements abstract org.apache.poi.poifs.crypt.Encryptor.getDataStream.

Doc from org.apache.poi.poifs.crypt.Encryptor.getDataStream.

Return an output stream for encrypted data.

Parameters
dir:DirectoryNode

the node to write to

Returns:OutputStream

encrypted stream

Annotations
@Override
marshallEncryptionDocumentback to summary
protected void marshallEncryptionDocument(EncryptionDocument ed, LittleEndianByteArrayOutputStream os)
updateIntegrityHMACback to summary
protected void updateIntegrityHMAC(File tmpFile, int oleStreamSize) throws GeneralSecurityException, IOException

Generate an HMAC, as specified in [RFC2104], of the encrypted form of the data (message), which the DataIntegrity element will verify by using the Salt generated in step 2 as the key. Note that the entire EncryptedPackage stream (1), including the StreamSize field, MUST be used as the message. Encrypt the HMAC as in step 3 by using a blockKey byte array consisting of the following bytes: 0xa0, 0x67, 0x7f, 0x02, 0xb2, 0x2c, 0x84, and 0x33.

org.apache.poi.poifs.crypt.agile back to summary

private Class AgileEncryptor.AgileCipherOutputStream

extends ChunkedCipherOutputStream
Class Inheritance

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.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
protected Cipher
private void
Inherited from org.apache.poi.poifs.crypt.ChunkedCipherOutputStream:
closegetChunkgetChunkMaskgetPlainByteFlagsgetPosgetTotalPosinitCipherForBlockinitCipherForBlockNoFlushinvokeCiphersetNextRecordSizewritewritewritewritewriteChunkwritePlain

Constructor Detail

AgileCipherOutputStreamback to summary
public AgileCipherOutputStream(DirectoryNode dir) throws IOException, GeneralSecurityException

Method Detail

calculateChecksumback to summary
protected void calculateChecksum(File fileOut, int oleStreamSize) throws GeneralSecurityException, IOException

Implements abstract org.apache.poi.poifs.crypt.ChunkedCipherOutputStream.calculateChecksum.

Annotations
@Override
createEncryptionInfoEntryback to summary
protected void createEncryptionInfoEntry(DirectoryNode dir, File tmpFile) throws IOException

Implements abstract org.apache.poi.poifs.crypt.ChunkedCipherOutputStream.createEncryptionInfoEntry.

Annotations
@Override
initCipherForBlockback to summary
protected Cipher initCipherForBlock(Cipher existing, int block, boolean lastChunk) throws GeneralSecurityException

Implements abstract org.apache.poi.poifs.crypt.ChunkedCipherOutputStream.initCipherForBlock.

Annotations
@Override
marshallEncryptionRecordback to summary
private void marshallEncryptionRecord(LittleEndianByteArrayOutputStream bos)