public class KeyPairGenerator
extends java.lang.Object
keygenOnInternalToken
to find out if this is happening.Modifier and Type | Field and Description |
---|---|
protected KeyPairAlgorithm |
algorithm |
protected KeyPairGeneratorSpi |
engine |
Constructor and Description |
---|
KeyPairGenerator(KeyPairAlgorithm algorithm,
KeyPairGeneratorSpi engine)
Creates a new key pair generator.
|
Modifier and Type | Method and Description |
---|---|
void |
extractablePairs(boolean extractable)
Tells the generator to generate extractable or unextractable
keypairs.
|
java.security.KeyPair |
genKeyPair()
Generates a new key pair.
|
KeyPairAlgorithm |
getAlgorithm() |
int |
getCurveCodeByName(java.lang.String curveName) |
void |
initialize(java.security.spec.AlgorithmParameterSpec params)
Initializes the generator with algorithm-specific parameters.
|
void |
initialize(java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
Initializes the generator with algorithm-specific parameters.
|
void |
initialize(int strength)
Initializes the generator with the strength of the keys.
|
void |
initialize(int strength,
java.security.SecureRandom random)
Initializes the generator with the strength of the keys.
|
boolean |
keygenOnInternalToken() |
void |
sensitivePairs(boolean sensitive)
Tells the generator to generate sensitive or insensitive keypairs.
|
void |
setKeyPairUsages(KeyPairGeneratorSpi.Usage[] usages,
KeyPairGeneratorSpi.Usage[] usages_mask) |
void |
temporaryPairs(boolean temp)
Tells the generator to generate temporary or permanent keypairs.
|
protected KeyPairAlgorithm algorithm
protected KeyPairGeneratorSpi engine
public KeyPairGenerator(KeyPairAlgorithm algorithm, KeyPairGeneratorSpi engine)
CryptoToken.getKeyPairGenerator
instead of calling this constructor.algorithm
- The type of keys that the generator will be
used to generate.engine
- The engine object that provides the implementation for
the class.public java.security.KeyPair genKeyPair() throws TokenException
KeyPairGenerator
.TokenException
- If an error occurs on the CryptoToken
in the process of generating the key pair.public KeyPairAlgorithm getAlgorithm()
public void initialize(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random) throws java.security.InvalidAlgorithmParameterException
params
- Algorithm-specific parameters for the key pair generation.random
- This parameter is ignored. NSS does not accept
an external source of random numbers.java.security.InvalidAlgorithmParameterException
- If the parameters are
inappropriate for the type of key pair that is being generated,
or they are not supported by this generator.RSAParameterSpec
,
DSAParameterSpec
public void initialize(java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidAlgorithmParameterException
params
- Algorithm-specific parameters for the key pair generation.java.security.InvalidAlgorithmParameterException
- If the parameters are
inappropriate for the type of key pair that is being generated,
or they are not supported by this generator.RSAParameterSpec
,
DSAParameterSpec
public void initialize(int strength, java.security.SecureRandom random)
strength
- The strength of the keys that will be generated.
Usually this is the length of the key in bits.random
- This parameter is ignored. NSS does not accept
an exterrnal source of random numbers.public void initialize(int strength)
strength
- The strength of the keys that will be generated.
Usually this is the length of the key in bits.public boolean keygenOnInternalToken()
public void temporaryPairs(boolean temp)
public void sensitivePairs(boolean sensitive)
public void extractablePairs(boolean extractable)
public void setKeyPairUsages(KeyPairGeneratorSpi.Usage[] usages, KeyPairGeneratorSpi.Usage[] usages_mask)
public int getCurveCodeByName(java.lang.String curveName) throws java.security.InvalidParameterException
java.security.InvalidParameterException