public class CryptoCipherFactory extends Object
CryptoCipher
instances.Modifier and Type | Class and Description |
---|---|
static class |
CryptoCipherFactory.CipherProvider
Defines the internal CryptoCipher implementations.
|
Modifier and Type | Field and Description |
---|---|
static int |
AES_BLOCK_SIZE
For AES, the algorithm block is fixed size of 128 bits.
|
static String |
CLASSES_KEY
The configuration key of the CryptoCipher implementation class.
|
static String |
JCE_PROVIDER_KEY
The configuration key of the provider class for JCE cipher.
|
Modifier and Type | Method and Description |
---|---|
static CryptoCipher |
getCryptoCipher(String transformation)
Gets a cipher for algorithm/mode/padding in config value
commons.crypto.cipher.transformation
|
static CryptoCipher |
getCryptoCipher(String transformation,
Properties properties)
Gets a cipher instance for specified algorithm/mode/padding.
|
public static final String JCE_PROVIDER_KEY
public static final String CLASSES_KEY
The value of CLASSES_KEY needs to be the full name of a
class that implements the
CryptoCipher
interface
The internal classes are listed in the enum
CipherProvider
which can be used to obtain the full class name.
The value can also be a comma-separated list of class names in order of descending priority.
public static final int AES_BLOCK_SIZE
public static CryptoCipher getCryptoCipher(String transformation) throws GeneralSecurityException
transformation
- the name of the transformation, e.g.,
AES/CBC/PKCS5Padding.
See the Java Cryptography Architecture Standard Algorithm Name Documentation
for information about standard transformation names.GeneralSecurityException
- if JCE cipher initialize failedpublic static CryptoCipher getCryptoCipher(String transformation, Properties properties) throws GeneralSecurityException
properties
- the configuration properties - uses CLASSES_KEY
transformation
- algorithm/mode/paddingGeneralSecurityException
- if cipher initialize failedIllegalArgumentException
- if no classname(s) were providedCopyright © 2016–2022 The Apache Software Foundation. All rights reserved.