org.apache.poi.poifs.crypt.agile
Class AgileEncryptor

java.lang.Object
  extended by org.apache.poi.poifs.crypt.Encryptor
      extended by org.apache.poi.poifs.crypt.agile.AgileEncryptor
All Implemented Interfaces:
java.lang.Cloneable

public class AgileEncryptor
extends Encryptor
implements java.lang.Cloneable


Field Summary
 
Fields inherited from class org.apache.poi.poifs.crypt.Encryptor
DEFAULT_POIFS_ENTRY
 
Constructor Summary
protected AgileEncryptor()
           
 
Method Summary
 AgileEncryptor clone()
           
 void confirmPassword(java.lang.String password)
           
 void confirmPassword(java.lang.String password, byte[] keySpec, byte[] keySalt, byte[] verifier, byte[] verifierSalt, byte[] integritySalt)
           
protected  com.microsoft.schemas.office.x2006.encryption.EncryptionDocument createEncryptionDocument()
           
protected  void createEncryptionInfoEntry(DirectoryNode dir, java.io.File tmpFile)
           
 java.io.OutputStream getDataStream(DirectoryNode dir)
           
protected  void marshallEncryptionDocument(com.microsoft.schemas.office.x2006.encryption.EncryptionDocument ed, LittleEndianByteArrayOutputStream os)
           
protected  void updateIntegrityHMAC(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.apache.poi.poifs.crypt.Encryptor
getDataStream, getDataStream, getDataStream, getDataStream, getEncryptionInfo, getInstance, getSecretKey, setChunkSize, setEncryptionInfo, setSecretKey
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgileEncryptor

protected AgileEncryptor()
Method Detail

confirmPassword

public void confirmPassword(java.lang.String password)
Specified by:
confirmPassword in class Encryptor

confirmPassword

public void confirmPassword(java.lang.String password,
                            byte[] keySpec,
                            byte[] keySalt,
                            byte[] verifier,
                            byte[] verifierSalt,
                            byte[] integritySalt)
Specified by:
confirmPassword in class Encryptor

getDataStream

public java.io.OutputStream getDataStream(DirectoryNode dir)
                                   throws java.io.IOException,
                                          java.security.GeneralSecurityException
Specified by:
getDataStream in class Encryptor
Throws:
java.io.IOException
java.security.GeneralSecurityException

updateIntegrityHMAC

protected void updateIntegrityHMAC(java.io.File tmpFile,
                                   int oleStreamSize)
                            throws java.security.GeneralSecurityException,
                                   java.io.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.

Throws:
java.security.GeneralSecurityException
java.io.IOException

createEncryptionDocument

protected com.microsoft.schemas.office.x2006.encryption.EncryptionDocument createEncryptionDocument()

marshallEncryptionDocument

protected void marshallEncryptionDocument(com.microsoft.schemas.office.x2006.encryption.EncryptionDocument ed,
                                          LittleEndianByteArrayOutputStream os)

createEncryptionInfoEntry

protected void createEncryptionInfoEntry(DirectoryNode dir,
                                         java.io.File tmpFile)
                                  throws java.io.IOException,
                                         java.security.GeneralSecurityException
Throws:
java.io.IOException
java.security.GeneralSecurityException

clone

public AgileEncryptor clone()
                     throws java.lang.CloneNotSupportedException
Overrides:
clone in class Encryptor
Throws:
java.lang.CloneNotSupportedException