iaik.cms
Interface CipherEngine

All Known Subinterfaces:
AuthCipherEngine, ByteArrayAuthCipherEngine, ByteArrayCipherEngine, InputStreamAuthCipherEngine, InputStreamCipherEngine

public interface CipherEngine

Generic Cipher engine. Used by EncryptedContentInfoStream and EncryptedContentInfo for content en/decryption. Setups a Cipher for encryption/decryption depending on the requested mode. Allows the implementation of en/deciphering utilities that may be independent from the JCE javax.crypto.Cipher engine. The default implementation, however, is based on the javax.crypto.Cipher engine.

An application may not immediately implement this interface. Rather it may implement on of the extending interfaces InputStreamCipherEngine or ByteArrayCipherEngine.

See Also:
ByteArrayCipherEngine, InputStreamCipherEngine, SecurityProvider

Field Summary
static int CIPHER_DECRYPT
          Constant for a cipher object which is to be initialized for decryption.
static int CIPHER_ENCRYPT
          Constant for a cipher object which is to be initialized for encryption.
static int CIPHER_NONE
          Constant for a cipher engine which is not to be initialized.
static int CIPHER_UNWRAP
          Constant for a cipher object which is to be initialized for decryption.
static int CIPHER_WRAP
          Constant for a cipher object which is to be initialized for key wrap.
 
Method Summary
 java.security.AlgorithmParameters getParameters()
          Gets any parameters generated by this CipherEngine after initialization.
 void initCipher(AlgorithmID algorithm, int mode, java.security.Key key, java.security.AlgorithmParameters params)
          Inits this CipherEngine.
 void initCipher(AlgorithmID algorithm, int mode, java.security.Key key, java.security.spec.AlgorithmParameterSpec paramSpec)
          Inits this CipherEngine.
 void setSecurityProvider(SecurityProvider securityProvider)
          Sets the SecurityProvider for this CipherEngine.
 

Field Detail

CIPHER_NONE

static final int CIPHER_NONE
Constant for a cipher engine which is not to be initialized.

See Also:
Constant Field Values

CIPHER_ENCRYPT

static final int CIPHER_ENCRYPT
Constant for a cipher object which is to be initialized for encryption.

See Also:
Constant Field Values

CIPHER_DECRYPT

static final int CIPHER_DECRYPT
Constant for a cipher object which is to be initialized for decryption.

See Also:
Constant Field Values

CIPHER_WRAP

static final int CIPHER_WRAP
Constant for a cipher object which is to be initialized for key wrap.

See Also:
Constant Field Values

CIPHER_UNWRAP

static final int CIPHER_UNWRAP
Constant for a cipher object which is to be initialized for decryption.

See Also:
Constant Field Values
Method Detail

setSecurityProvider

void setSecurityProvider(SecurityProvider securityProvider)
Sets the SecurityProvider for this CipherEngine.

Parameters:
securityProvider - the SecurityProvider to be set

initCipher

void initCipher(AlgorithmID algorithm,
                int mode,
                java.security.Key key,
                java.security.AlgorithmParameters params)
                throws java.security.NoSuchAlgorithmException,
                       java.security.InvalidKeyException,
                       java.security.InvalidAlgorithmParameterException
Inits this CipherEngine.

Parameters:
algorithm - the cipher algorithm to be used
mode - the cipher mode to be used (CIPHER_NONE, CIPHER_ENCRYPT, CIPHER_DECRYPT, CIPHER_WRAP, or CIPHER_UNWRAP)
key - the key to be used for en/deciphering
params - any algorithm parameters required by the cipher algorithm
Throws:
java.security.NoSuchAlgorithmException - if the requested cipher algorithm is not supported
java.security.InvalidKeyException - if there is a key related problem
java.security.InvalidAlgorithmParameterException - if the parameters are not valid for the requested algorithm

initCipher

void initCipher(AlgorithmID algorithm,
                int mode,
                java.security.Key key,
                java.security.spec.AlgorithmParameterSpec paramSpec)
                throws java.security.NoSuchAlgorithmException,
                       java.security.InvalidKeyException,
                       java.security.InvalidAlgorithmParameterException
Inits this CipherEngine.

Parameters:
algorithm - the cipher algorithm to be used
mode - the cipher mode to be used (CIPHER_NONE, CIPHER_ENCRYPT, CIPHER_DECRYPT, CIPHER_WRAP, or CIPHER_UNWRAP)
key - the key to be used for en/deciphering
paramSpec - any algorithm parameters required by the cipher algorithm
Throws:
java.security.NoSuchAlgorithmException - if the requested cipher algorithm is not supported
java.security.InvalidKeyException - if there is a key related problem
java.security.InvalidAlgorithmParameterException - if the parameters are not valid for the requested algorithm

getParameters

java.security.AlgorithmParameters getParameters()
Gets any parameters generated by this CipherEngine after initialization.

Returns:
any parameters generated/used by this CipherEngine after initialization, or null if no parameters are generated/used

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK-CMS 5.1, (c) 2002 IAIK, (c) 2003 - 2010 SIC