You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.




org.mozilla.jss.crypto
Class KeyPairGenerator

java.lang.Object
  extended by org.mozilla.jss.crypto.KeyPairGenerator

Deprecated. Use the JCA interface instead (KeyPairGenerator)

public class KeyPairGenerator
extends java.lang.Object

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. Call keygenOnInternalToken to find out if this is happening.

See Also:
CryptoToken.getKeyPairGenerator(org.mozilla.jss.crypto.KeyPairAlgorithm)

Field Summary
protected  KeyPairAlgorithm algorithm
          Deprecated.  
protected  KeyPairGeneratorSpi engine
          Deprecated.  
 
Constructor Summary
KeyPairGenerator(KeyPairAlgorithm algorithm, KeyPairGeneratorSpi engine)
          Deprecated. Creates a new key pair generator.
 
Method Summary
 void extractablePairs(boolean extractable)
          Deprecated. Tells the generator to generate extractable or unextractable keypairs.
 java.security.KeyPair genKeyPair()
          Deprecated. Generates a new key pair.
 KeyPairAlgorithm getAlgorithm()
          Deprecated.  
 void initialize(java.security.spec.AlgorithmParameterSpec params)
          Deprecated. Initializes the generator with algorithm-specific parameters.
 void initialize(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)
          Deprecated. Initializes the generator with algorithm-specific parameters.
 void initialize(int strength)
          Deprecated. Initializes the generator with the strength of the keys.
 void initialize(int strength, java.security.SecureRandom random)
          Deprecated. Initializes the generator with the strength of the keys.
 boolean keygenOnInternalToken()
          Deprecated.  
 void sensitivePairs(boolean sensitive)
          Deprecated. Tells the generator to generate sensitive or insensitive keypairs.
 void temporaryPairs(boolean temp)
          Deprecated. Tells the generator to generate temporary or permanent keypairs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

algorithm

protected KeyPairAlgorithm algorithm
Deprecated. 

engine

protected KeyPairGeneratorSpi engine
Deprecated. 
Constructor Detail

KeyPairGenerator

public KeyPairGenerator(KeyPairAlgorithm algorithm,
                        KeyPairGeneratorSpi engine)
Deprecated. 
Creates a new key pair generator. KeyPairGenerators should be obtained by calling 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.
Method Detail

genKeyPair

public java.security.KeyPair genKeyPair()
                                 throws TokenException
Deprecated. 
Generates a new key pair.

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.

getAlgorithm

public KeyPairAlgorithm getAlgorithm()
Deprecated. 
Returns:
The type of key that this generator generates.

initialize

public void initialize(java.security.spec.AlgorithmParameterSpec params,
                       java.security.SecureRandom random)
                throws java.security.InvalidAlgorithmParameterException
Deprecated. 
Initializes the generator with algorithm-specific parameters. The SecureRandom parameters is ignored.

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:
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.
See Also:
RSAParameterSpec, DSAParameterSpec

initialize

public void initialize(java.security.spec.AlgorithmParameterSpec params)
                throws java.security.InvalidAlgorithmParameterException
Deprecated. 
Initializes the generator with algorithm-specific parameters.

Parameters:
params - Algorithm-specific parameters for the key pair generation.
Throws:
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.
See Also:
RSAParameterSpec, DSAParameterSpec

initialize

public void initialize(int strength,
                       java.security.SecureRandom random)
Deprecated. 
Initializes the generator with the strength of the keys. The SecureRandom parameter is ignored.

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.

initialize

public void initialize(int strength)
Deprecated. 
Initializes the generator with the strength of the keys.

Parameters:
strength - The strength of the keys that will be generated. Usually this is the length of the key in bits.

keygenOnInternalToken

public boolean keygenOnInternalToken()
Deprecated. 
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.

temporaryPairs

public void temporaryPairs(boolean temp)
Deprecated. 
Tells the generator to generate temporary or permanent keypairs. Temporary keys are not written permanently to the token. They are destroyed by the garbage collector. If this method is not called, the default is permanent keypairs.


sensitivePairs

public void sensitivePairs(boolean sensitive)
Deprecated. 
Tells the generator to generate sensitive or insensitive keypairs. Certain attributes of a sensitive key cannot be revealed in plaintext outside the token. If this method is not called, the default depends on the temporaryPairs mode for backward compatibility. The default is sensitive keypairs if the temporaryPairs mode is false, or insensitive keypairs if the temporaryPairs mode is true.


extractablePairs

public void extractablePairs(boolean extractable)
Deprecated. 
Tells the generator to generate extractable or unextractable keypairs. Extractable keys can be extracted from the token after wrapping. If this method is not called, the default is token dependent.