Class AgileEncryptor
java.lang.Object
org.docx4j.org.apache.poi.poifs.crypt.Encryptor
org.docx4j.org.apache.poi.poifs.crypt.agile.AgileEncryptor
public class AgileEncryptor extends Encryptor
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedAgileEncryptor(AgileEncryptionInfoBuilder builder) -
Method Summary
Modifier and Type Method Description voidconfirmPassword(java.lang.String password)voidconfirmPassword(java.lang.String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)protected CTEncryptioncreateEncryptionDocument()protected voidcreateEncryptionInfoEntry(DirectoryNode dir, java.io.File tmpFile)java.io.OutputStreamgetDataStream(DirectoryNode dir)Return a output stream for encrypted data.protected voidmarshallEncryptionDocument(CTEncryption ed, LittleEndianByteArrayOutputStream os)protected voidupdateIntegrityHMAC(java.io.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.Methods inherited from class org.docx4j.org.apache.poi.poifs.crypt.Encryptor
getDataStream, getDataStream, getDataStream, getInstance, getSecretKey, setSecretKey
-
Constructor Details
-
Method Details
-
confirmPassword
public void confirmPassword(java.lang.String password)- Specified by:
confirmPasswordin classEncryptor
-
confirmPassword
public void confirmPassword(java.lang.String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)- Specified by:
confirmPasswordin classEncryptor
-
getDataStream
public java.io.OutputStream getDataStream(DirectoryNode dir) throws java.io.IOException, java.security.GeneralSecurityExceptionDescription copied from class:EncryptorReturn a output stream for encrypted data.- Specified by:
getDataStreamin classEncryptor- Parameters:
dir- the node to write to- Returns:
- encrypted stream
- Throws:
java.io.IOExceptionjava.security.GeneralSecurityException
-
updateIntegrityHMAC
protected void updateIntegrityHMAC(java.io.File tmpFile, int oleStreamSize) throws java.security.GeneralSecurityException, java.io.IOExceptionGenerate 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.- Throws:
java.security.GeneralSecurityExceptionjava.io.IOException
-
createEncryptionDocument
-
marshallEncryptionDocument
-
createEncryptionInfoEntry
protected void createEncryptionInfoEntry(DirectoryNode dir, java.io.File tmpFile) throws java.io.IOException, java.security.GeneralSecurityException- Throws:
java.io.IOExceptionjava.security.GeneralSecurityException
-