CipherHandler(final SecretKey key,final byte[] nonce,final byte[] contentAad,final int cipherMode,final CryptoAlgorithm cryptoAlgorithm){
  if (nonce.length != cryptoAlgorithm.getNonceLen()) {
    throw new IllegalArgumentException("Invalid nonce length: " + nonce.length);
  }
  final AlgorithmParameterSpec spec=new GCMParameterSpec(cryptoAlgorithm.getTagLen() * 8,nonce,0,nonce.length);
  try {
    cipher_=buildCipherObject(cryptoAlgorithm);
    cipher_.init(cipherMode,key,spec);
    if (contentAad != null) {
      cipher_.updateAAD(contentAad);
    }
  }
 catch (  final GeneralSecurityException gsx) {
    throw new AwsCryptoException(gsx);
  }
}

CipherHandler ( final SecretKey key , final byte [ ] nonce , final byte [ ] contentAad , final int cipherMode , final CryptoAlgorithm cryptoAlgorithm ) { if ( nonce . length != cryptoAlgorithm . getNonceLen ( ) ) { throw new IllegalArgumentException ( "Invalid nonce length: " + nonce . length ) ; } final AlgorithmParameterSpec spec = new GCMParameterSpec ( cryptoAlgorithm . getTagLen ( ) * 8 , nonce , 0 , nonce . length ) ; try { cipher_ = buildCipherObject ( cryptoAlgorithm ) ; cipher_ . init ( cipherMode , key , spec ) ; if ( contentAad != null ) { cipher_ . updateAAD ( contentAad ) ; } } catch ( final GeneralSecurityException gsx ) { throw new AwsCryptoException ( gsx ) ; } }
create a cipher handler for processing bytes using an underlying block cipher .
