org.mozilla.jss.crypto
public class KeyPairGenerator extends Object
Deprecated: Use the JCA interface instead (java.security.KeyPairGenerator)
Generates RSA and DSA key pairs. Each CryptoToken provides a KeyPairGenerator, which can be used to generate key pairs on that token. A given token may not support all algorithms, and some tokens may not support any key pair generation. If a token does not support key pair generation, the Netscape internal token may do it instead. CallkeygenOnInternalToken
to find out if this is happening.
See Also: CryptoToken
Field Summary | |
---|---|
protected KeyPairAlgorithm | algorithm |
protected KeyPairGeneratorSpi | engine |
Constructor Summary | |
---|---|
KeyPairGenerator(KeyPairAlgorithm algorithm, KeyPairGeneratorSpi engine)
Creates a new key pair generator. |
Method Summary | |
---|---|
void | extractablePairs(boolean extractable)
Tells the generator to generate extractable or unextractable
keypairs. |
KeyPair | genKeyPair()
Generates a new key pair.
|
KeyPairAlgorithm | getAlgorithm() |
void | initialize(AlgorithmParameterSpec params, SecureRandom random)
Initializes the generator with algorithm-specific parameters.
|
void | initialize(AlgorithmParameterSpec params)
Initializes the generator with algorithm-specific parameters.
|
void | initialize(int strength, SecureRandom random)
Initializes the generator with the strength of the keys.
|
void | initialize(int strength)
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.
|
CryptoToken.getKeyPairGenerator
instead of calling this constructor.
Parameters: algorithm The type of keys that the generator will be used to generate. engine The engine object that provides the implementation for the class.
Returns: A new key pair. The keys reside on the CryptoToken that
provided this KeyPairGenerator
.
Throws: TokenException If an error occurs on the CryptoToken in the process of generating the key pair.
Returns: The type of key that this generator generates.
Parameters: params Algorithm-specific parameters for the key pair generation. random This parameter is ignored. NSS does not accept an external source of random numbers.
Throws: InvalidAlgorithmParameterException If the parameters are inappropriate for the type of key pair that is being generated, or they are not supported by this generator.
See Also: RSAParameterSpec java.security.spec.DSAParameterSpec
Parameters: params Algorithm-specific parameters for the key pair generation.
Throws: InvalidAlgorithmParameterException If the parameters are inappropriate for the type of key pair that is being generated, or they are not supported by this generator.
See Also: RSAParameterSpec java.security.spec.DSAParameterSpec
Parameters: 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.
Parameters: strength The strength of the keys that will be generated. Usually this is the length of the key in bits.
Returns: true if the keypair generation will take place on the internal token rather than the current token. This will happen if the token does not support keypair generation but does support this algorithm and is writable. In this case the keypair will be generated on the Netscape internal token and then moved to this token.