public class SecretKeyFactoryExtensions extends Object
SecretKeyFactory holds methods for creating SecretKeySpec
objects.| Constructor and Description |
|---|
SecretKeyFactoryExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static SecretKey |
newSecretKey(char[] password,
String algorithm)
Factory method for creating a new
SecretKey from the given password and algorithm. |
static SecretKeyFactory |
newSecretKeyFactory(String algorithm)
Factory method for creating a new
SecretKeyFactory from the given algorithm. |
static SecretKeySpec |
newSecretKeySpec(byte[] secretKey,
String algorithm)
Factory method for creating a new
SecretKeySpec from the given algorithm and the
given secret key as byte array. |
static SecretKeySpec |
newSecretKeySpec(String algorithm,
int keyLength)
Factory method for creating a new
SecretKeySpec from the given algorithm and the
given key length. |
public static SecretKeyFactory newSecretKeyFactory(String algorithm) throws NoSuchAlgorithmException
SecretKeyFactory from the given algorithm.algorithm - the algorithmSecretKeyFactory from the given algorithm.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.public static SecretKeySpec newSecretKeySpec(String algorithm, int keyLength) throws NoSuchAlgorithmException
SecretKeySpec from the given algorithm and the
given key length.algorithm - the algorithmkeyLength - the key lengthSecretKeySpec from the given algorithm and the given key length.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.public static SecretKeySpec newSecretKeySpec(byte[] secretKey, String algorithm) throws NoSuchAlgorithmException
SecretKeySpec from the given algorithm and the
given secret key as byte array.algorithm - the algorithmsecretKey - the secret keySecretKeySpec from the given algorithm and the given secret key.NoSuchAlgorithmException - the no such algorithm exceptionpublic static SecretKey newSecretKey(char[] password, String algorithm) throws NoSuchAlgorithmException, InvalidKeySpecException
SecretKey from the given password and algorithm.password - the passwordalgorithm - the algorithmSecretKey from the given password and algorithm.NoSuchAlgorithmException - is thrown if instantiation of the SecretKeyFactory object fails.InvalidKeySpecException - is thrown if generation of the SecretKey object fails.Copyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.