|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mozilla.jss.crypto.KeyPairGenerator
public class 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. Call
keygenOnInternalToken
to find out if this is happening.
CryptoToken.getKeyPairGenerator(org.mozilla.jss.crypto.KeyPairAlgorithm)
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. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected KeyPairAlgorithm algorithm
protected KeyPairGeneratorSpi engine
Constructor Detail |
---|
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.Method Detail |
---|
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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |