XCMS Toolkit

com.cms.crypto
Class CipherAlgorithmFactory

java.lang.Object
  extended by com.cms.crypto.CipherAlgorithmFactory

public class CipherAlgorithmFactory
extends java.lang.Object

Resolves a value of type ASN.1 OBJECT IDENTIFIER into a Cipher Algorithm Cipher object.

Note that only CXER and DER encoding rules are currently supported.

Version:
1.00 - 2006/02/12
Author:
support@phillipgriffin.com

Field Summary
static byte[] DEFAULT_AES_CBC_IV
           
static byte[] DEFAULT_DESede_CBC_IV
           
static java.lang.String DEFAULT_XER_AES_CBC_IV
           
static java.lang.String DEFAULT_XER_DESede_CBC_IV
           
 
Method Summary
 javax.crypto.Cipher createForDecryption(java.security.PrivateKey key, KeyEncryptionAlgorithmIdentifier algorithm)
          Return a Cipher object that is ready for encryption
 javax.crypto.Cipher createForDecryption(javax.crypto.SecretKey key, ContentEncryptionAlgorithmIdentifier algorithm)
          Return a Cipher object that is ready for decryption.
 javax.crypto.Cipher createForDecryption(javax.crypto.SecretKey key, KeyEncryptionAlgorithmIdentifier algorithm)
          Creates a cipher for use in a decryption transform.
 javax.crypto.Cipher createForEncryption(java.security.PublicKey key, KeyEncryptionAlgorithmIdentifier algorithm)
          Return a Cipher object ready for encryption.
 javax.crypto.Cipher createForEncryption(javax.crypto.SecretKey key, ContentEncryptionAlgorithmIdentifier algorithm)
          Returns a Cipher object ready for encryption.
 javax.crypto.Cipher createForEncryption(javax.crypto.SecretKey key, KeyEncryptionAlgorithmIdentifier algorithm)
          Creates a cipher for use in an encryption transform.
static CipherAlgorithmFactory getInstance(Codec codec)
          Create a Cipher algorithm factory object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_XER_AES_CBC_IV

public static final java.lang.String DEFAULT_XER_AES_CBC_IV
See Also:
Constant Field Values

DEFAULT_XER_DESede_CBC_IV

public static final java.lang.String DEFAULT_XER_DESede_CBC_IV
See Also:
Constant Field Values

DEFAULT_AES_CBC_IV

public static final byte[] DEFAULT_AES_CBC_IV

DEFAULT_DESede_CBC_IV

public static final byte[] DEFAULT_DESede_CBC_IV
Method Detail

getInstance

public static CipherAlgorithmFactory getInstance(Codec codec)
                                          throws CryptoException
Create a Cipher algorithm factory object.

Parameters:
codec - ASN.1 encoding rules
Returns:
a Cipher algorithm factory object ready for use
Throws:
CryptoException

createForEncryption

public javax.crypto.Cipher createForEncryption(javax.crypto.SecretKey key,
                                               ContentEncryptionAlgorithmIdentifier algorithm)
                                        throws CryptoException,
                                               EncodingException,
                                               java.security.InvalidKeyException,
                                               java.security.InvalidAlgorithmParameterException,
                                               java.io.IOException,
                                               java.security.NoSuchAlgorithmException,
                                               javax.crypto.NoSuchPaddingException
Returns a Cipher object ready for encryption.

Parameters:
key - the secret key that will be used by the cipher
algorithm - a value of ASN.1 type ContentEncryptionAlgorithmIdentifier whose algorithm and associated parameters will be used to encrypt data
Returns:
null or a Cipher algorithm object that is ready for encryption
Throws:
DecodingException
EncodingException
java.security.InvalidAlgorithmParameterException
java.security.InvalidKeyException
java.io.IOException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
CryptoException

createForEncryption

public javax.crypto.Cipher createForEncryption(java.security.PublicKey key,
                                               KeyEncryptionAlgorithmIdentifier algorithm)
                                        throws java.security.NoSuchAlgorithmException,
                                               javax.crypto.NoSuchPaddingException,
                                               java.security.InvalidKeyException,
                                               java.security.InvalidAlgorithmParameterException,
                                               java.io.IOException
Return a Cipher object ready for encryption.

Parameters:
key - a Key Encryption Key (KEK)
algorithm - a value of ASN.1 type KeyEncryptionAlgorithmIdentifier whose algorithm, a key encryption algorithm, will be used to encrypt a key using the KEK
Returns:
null or a Cipher algorithm object that is ready for encryption
Throws:
DecodingException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
java.io.IOException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException

createForDecryption

public javax.crypto.Cipher createForDecryption(javax.crypto.SecretKey key,
                                               ContentEncryptionAlgorithmIdentifier algorithm)
                                        throws java.security.NoSuchAlgorithmException,
                                               EncodingException,
                                               javax.crypto.NoSuchPaddingException,
                                               java.security.InvalidKeyException,
                                               java.security.InvalidAlgorithmParameterException,
                                               java.io.IOException,
                                               CryptoException
Return a Cipher object that is ready for decryption.

Parameters:
key - a symmetric Content Encryption Key (KEK)
algorithm - a value of ASN.1 type ContentEncryptionAlgorithmIdentifier that will be used to decrypt ciphertext to recover the encrypted plaintext
Returns:
a Cipher algorithm object ready for decryption
Throws:
DecodingException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
java.io.IOException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
EncodingException
CryptoException

createForDecryption

public javax.crypto.Cipher createForDecryption(java.security.PrivateKey key,
                                               KeyEncryptionAlgorithmIdentifier algorithm)
                                        throws java.security.NoSuchAlgorithmException,
                                               javax.crypto.NoSuchPaddingException,
                                               java.security.InvalidKeyException,
                                               java.security.InvalidAlgorithmParameterException,
                                               java.io.IOException
Return a Cipher object that is ready for encryption

Parameters:
key - a private asymmetric Key Encryption Key (KEK)
algorithm - a value of ASN.1 type KeyEncryptionAlgorithmIdentifier that will be used to encrypt a Content Encryption Key (CEK)
Returns:
null or a Cipher algorithm object that is ready for encryption
Throws:
DecodingException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
java.io.IOException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException

createForEncryption

public javax.crypto.Cipher createForEncryption(javax.crypto.SecretKey key,
                                               KeyEncryptionAlgorithmIdentifier algorithm)
                                        throws java.security.NoSuchAlgorithmException,
                                               javax.crypto.NoSuchPaddingException,
                                               java.security.InvalidKeyException,
                                               java.security.InvalidAlgorithmParameterException,
                                               java.io.IOException,
                                               CryptoException
Creates a cipher for use in an encryption transform.

Parameters:
key -
algorithm -
Returns:
null or a Cipher algorithm object that is ready for encryption
Throws:
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
java.io.IOException
CryptoException

createForDecryption

public javax.crypto.Cipher createForDecryption(javax.crypto.SecretKey key,
                                               KeyEncryptionAlgorithmIdentifier algorithm)
                                        throws java.security.NoSuchAlgorithmException,
                                               javax.crypto.NoSuchPaddingException,
                                               java.security.InvalidKeyException,
                                               java.security.InvalidAlgorithmParameterException,
                                               java.io.IOException,
                                               CryptoException
Creates a cipher for use in a decryption transform.

Parameters:
key -
algorithm -
Returns:
null or a Cipher algorithm object that is ready for encryption
Throws:
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
java.io.IOException
CryptoException

XCMS Toolkit


Copyright © 2005-2006 GRIFFIN Consulting. All Rights Reserved.