public class MacKeyGenerator
extends javax.crypto.KeyGeneratorSpi
Modifier and Type | Class and Description |
---|---|
static class |
MacKeyGenerator.MacKeyGeneratorSha224
KeyMaterialGenerator for deriving a PKCS#12 MAC-Key from a password,
a salt and an iteration count, using SHA-224 as hash function.
|
static class |
MacKeyGenerator.MacKeyGeneratorSha256
KeyMaterialGenerator for deriving a PKCS#12 MAC-Key from a password,
a salt and an iteration count, using SHA-256 as hash function.
|
static class |
MacKeyGenerator.MacKeyGeneratorSha384
KeyMaterialGenerator for deriving a PKCS#12 MAC-Key from a password,
a salt and an iteration count, using SHA-384 as hash function.
|
static class |
MacKeyGenerator.MacKeyGeneratorSha512
KeyMaterialGenerator for deriving a PKCS#12 MAC-Key from a password,
a salt and an iteration count, using SHA-512 as hash function.
|
static class |
MacKeyGenerator.MacKeyGeneratorSha512_224
KeyMaterialGenerator for deriving a PKCS#12 MAC-Key from a password,
a salt and an iteration count, using SHA-512/224 as hash function.
|
static class |
MacKeyGenerator.MacKeyGeneratorSha512_256
KeyMaterialGenerator for deriving a PKCS#12 MAC-Key from a password,
a salt and an iteration count, using SHA-512/256 as hash function.
|
Constructor and Description |
---|
MacKeyGenerator()
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 MacKeyGenerator()
protected void engineInit(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterException
engineInit
in class javax.crypto.KeyGeneratorSpi
params
- the required parameters as PBEKeyAndParameterSpecrandom
- not needed by this key generatorjava.security.InvalidAlgorithmParameterException
protected void engineInit(int keylen, java.security.SecureRandom random)
engineInit
in class javax.crypto.KeyGeneratorSpi
protected void engineInit(java.security.SecureRandom random)
engineInit
in class javax.crypto.KeyGeneratorSpi
protected 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