public class CipherFactory extends Object
CipherFactory holds methods for creating Cipher objects.| Constructor and Description |
|---|
CipherFactory() |
| Modifier and Type | Method and Description |
|---|---|
static Cipher |
newCipher(int operationMode,
SecretKey key,
AlgorithmParameterSpec paramSpec,
String algorithm)
Factory method for creating a new
Cipher from the given parameters. |
static Cipher |
newCipher(String algorithm)
Factory method for creating a new
Cipher from the given algorithm. |
static Cipher |
newCipher(String algorithm,
String provider)
Factory method for creating a new
Cipher from the given algorithm and provider. |
static Cipher |
newCipher(String privateKey,
String algorithm,
byte[] salt,
int iterationCount,
int operationMode)
Factory method for creating a new
Cipher from the given parameters. |
public static Cipher newCipher(int operationMode, SecretKey key, AlgorithmParameterSpec paramSpec, String algorithm) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException
Cipher from the given parameters.operationMode - the operation modekey - the keyparamSpec - the param specalgorithm - the algorithmCipherNoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.NoSuchPaddingException - is thrown if instantiation of the cypher object fails.InvalidKeyException - is thrown if initialization of the cypher object fails.InvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.public static Cipher newCipher(String algorithm) throws NoSuchAlgorithmException, NoSuchPaddingException
Cipher from the given algorithm.algorithm - the algCipherNoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.NoSuchPaddingException - is thrown if instantiation of the cypher object fails.public static Cipher newCipher(String algorithm, String provider) throws NoSuchAlgorithmException, NoSuchProviderException, NoSuchPaddingException
Cipher from the given algorithm and provider.algorithm - the algorithmprovider - the providerCipherNoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.NoSuchProviderException - is thrown if the specified provider is not registered in the security provider
list.NoSuchPaddingException - is thrown if algorithm contains a padding scheme that is not available.public static Cipher newCipher(String privateKey, String algorithm, byte[] salt, int iterationCount, int operationMode) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, UnsupportedEncodingException
Cipher from the given parameters. This method is
invoked in the constructor from the derived classes and can be overridden so users can
provide their own version of a new Cipher from the given parameters.privateKey - the private keyalgorithm - the algorithmsalt - the salt.iterationCount - the iteration countoperationMode - the operation mode for the new cipher objectNoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.NoSuchPaddingException - is thrown if instantiation of the cypher object fails.InvalidKeyException - is thrown if initialization of the cypher object fails.InvalidAlgorithmParameterException - is thrown if initialization of the cypher object fails.UnsupportedEncodingException - is thrown if the named charset is not supported.Copyright © 2015–2017 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.