public class SecretKeyGenerator
extends javax.crypto.KeyGeneratorSpi
| Modifier and Type | Class and Description |
|---|---|
static class |
SecretKeyGenerator.SecretKeyGeneratorSha224
KeyMaterialGenerator for deriving a PKCS#12 secret key from a password,
a salt and an iteration count, using SHA-224 as hash function.
|
static class |
SecretKeyGenerator.SecretKeyGeneratorSha256
KeyMaterialGenerator for deriving a PKCS#12 secret key from a password,
a salt and an iteration count, using SHA-256 as hash function.
|
static class |
SecretKeyGenerator.SecretKeyGeneratorSha384
KeyMaterialGenerator for deriving a PKCS#12 secret key from a password,
a salt and an iteration count, using SHA-384 as hash function.
|
static class |
SecretKeyGenerator.SecretKeyGeneratorSha512
KeyMaterialGenerator for deriving a PKCS#12 secret key from a password,
a salt and an iteration count, using SHA-512 as hash function.
|
static class |
SecretKeyGenerator.SecretKeyGeneratorSha512_224
KeyMaterialGenerator for deriving a PKCS#12 secret key from a password,
a salt and an iteration count, using SHA-512/224 as hash function.
|
static class |
SecretKeyGenerator.SecretKeyGeneratorSha512_256
KeyMaterialGenerator for deriving a PKCS#12 secret key from a password,
a salt and an iteration count, using SHA-512/256 as hash function.
|
| Constructor and Description |
|---|
SecretKeyGenerator()
Default Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected javax.crypto.SecretKey |
engineGenerateKey()
Generates the desired key material and returns it as a SecretKey.
|
protected void |
engineInit(java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
Inits this KeyMaterialGenerator.
|
protected void |
engineInit(int keylen,
java.security.SecureRandom random)
Sets the length of the key to generate.
|
protected void |
engineInit(java.security.SecureRandom random)
Not implemented.
|
public SecretKeyGenerator()
protected void engineInit(java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
throws java.security.InvalidAlgorithmParameterException
engineInit in class javax.crypto.KeyGeneratorSpiparams - the required parameters as PBEKeyAndParameterSpecrandom - not needed by this key generatorjava.security.InvalidAlgorithmParameterExceptionprotected void engineInit(int keylen,
java.security.SecureRandom random)
engineInit in class javax.crypto.KeyGeneratorSpiprotected void engineInit(java.security.SecureRandom random)
engineInit in class javax.crypto.KeyGeneratorSpiprotected javax.crypto.SecretKey engineGenerateKey()
String algorithm = ...;
KeyGenerator keyGen = KeyGenerator.getInstance("PKCS#12", "IAIK");
...
iaik.security.cipher.SecretKey secretKey = (iaik.security.cipher.SecretKey)keyGen.generateKey();
secretKey.setAlgorithm(algorithm);
engineGenerateKey in class javax.crypto.KeyGeneratorSpi