public interface CipherEngine
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
.
Modifier and Type | Field and Description |
---|---|
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.
|
Modifier and Type | Method and Description |
---|---|
java.security.AlgorithmParameters |
getParameters()
Gets any parameters generated by this CipherEngine after initialization.
|
void |
initCipher(iaik.asn1.structures.AlgorithmID algorithm,
int mode,
java.security.Key key,
java.security.AlgorithmParameters params)
Inits this CipherEngine.
|
void |
initCipher(iaik.asn1.structures.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.
|
static final int CIPHER_NONE
static final int CIPHER_ENCRYPT
static final int CIPHER_DECRYPT
static final int CIPHER_WRAP
static final int CIPHER_UNWRAP
void setSecurityProvider(SecurityProvider securityProvider)
securityProvider
- the SecurityProvider to be setvoid initCipher(iaik.asn1.structures.AlgorithmID algorithm, int mode, java.security.Key key, java.security.AlgorithmParameters params) throws java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
algorithm
- the cipher algorithm to be usedmode
- 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/decipheringparams
- any algorithm parameters required by the cipher algorithmjava.security.NoSuchAlgorithmException
- if the requested cipher algorithm is not supportedjava.security.InvalidKeyException
- if there is a key related problemjava.security.InvalidAlgorithmParameterException
- if the parameters are not valid for the requested algorithmvoid initCipher(iaik.asn1.structures.AlgorithmID algorithm, int mode, java.security.Key key, java.security.spec.AlgorithmParameterSpec paramSpec) throws java.security.NoSuchAlgorithmException, java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
algorithm
- the cipher algorithm to be usedmode
- 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/decipheringparamSpec
- any algorithm parameters required by the cipher algorithmjava.security.NoSuchAlgorithmException
- if the requested cipher algorithm is not supportedjava.security.InvalidKeyException
- if there is a key related problemjava.security.InvalidAlgorithmParameterException
- if the parameters are not valid for the requested algorithmjava.security.AlgorithmParameters getParameters()
null
if no parameters are generated/used