Modifier and Type | Field and Description |
---|---|
static char |
SEPARATOR
Character to divide algorithm name and parameter
|
static java.lang.String |
STR_SEPARATOR
String to divide algorithm name and parameter
|
Constructor and Description |
---|
KeyPairGenerator(PairGeneratorInterface generator)
ctor.
|
Modifier and Type | Method and Description |
---|---|
void |
clean()
clean all important content.
|
java.security.KeyPair |
generateKeyPair()
Generates a key pair.
|
java.lang.String |
getAlgorithm()
Get algorithm name.
|
static KeyPairGenerator |
getInstance(java.lang.String algorithm)
Algorithm factory, create object by algorithm name.
|
static KeyPairGenerator |
getInstance(java.lang.String algorithm,
java.security.Provider provider)
Algorithm factory, create object by algorithm name.
|
static KeyPairGenerator |
getInstance(java.lang.String algorithm,
java.lang.String provider)
Algorithm factory, create object by algorithm name.
|
static java.security.spec.AlgorithmParameterSpec |
getParam(java.lang.String paramsName)
create parameter by oid
|
java.security.Provider |
getProvider()
Returns the provider of this object.
|
void |
initialize(java.security.spec.AlgorithmParameterSpec params)
Initializes the key pair generator using the specified parameter set.
|
void |
initialize(java.security.spec.AlgorithmParameterSpec params,
SecureRandom random)
Initializes the key pair generator using the specified parameter set and user-provided source of randomness.
|
void |
initialize(int keySize)
Initializes the key pair generator for a certain keySize, using the default parameter set.
|
void |
initialize(int keySize,
SecureRandom random)
Initializes the key pair generator for a certain keySize, using the default parameter set.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
public static final char SEPARATOR
public static final java.lang.String STR_SEPARATOR
public KeyPairGenerator(PairGeneratorInterface generator)
generator
- implementationpublic static KeyPairGenerator getInstance(java.lang.String algorithm) throws java.security.NoSuchAlgorithmException
KeyPairGenerator.getInstance(String)
.
Algorithm parameter can be set here "GOST3410/1.2.643.2.2.35.1".algorithm
- algorithm name.java.security.NoSuchAlgorithmException
- if the specified algorithm is not availablepublic static KeyPairGenerator getInstance(java.lang.String algorithm, java.lang.String provider) throws java.security.NoSuchAlgorithmException
KeyPairGenerator.getInstance(String)
.
Algorithm parameter can be set here "GOST3410/1.2.643.2.2.35.1".algorithm
- algorithm name.provider
- unusedjava.security.NoSuchAlgorithmException
- if the specified algorithm is not availablepublic static KeyPairGenerator getInstance(java.lang.String algorithm, java.security.Provider provider) throws java.security.NoSuchAlgorithmException
KeyPairGenerator.getInstance(String)
.
Algorithm parameter can be set here "GOST3410/1.2.643.2.2.35.1".algorithm
- algorithm name.provider
- unusedjava.security.NoSuchAlgorithmException
- if the specified algorithm is not availablepublic static java.security.spec.AlgorithmParameterSpec getParam(java.lang.String paramsName) throws java.security.InvalidAlgorithmParameterException
paramsName
- oidjava.security.InvalidAlgorithmParameterException
- invalid algorithm parameterpublic java.lang.String getAlgorithm()
public java.security.Provider getProvider()
public void initialize(int keySize)
keySize
- the keySize. This is an algorithm-specific metric, such as modulus length,
specified in number of bits.java.security.InvalidParameterException
- if the keySize
is not supported by this object.public void initialize(int keySize, SecureRandom random)
keySize
- the keySize. This is an algorithm-specific metric, such as modulus length,
specified in number of bits.random
- the source of randomness for this generator.java.security.InvalidParameterException
- if the keySize
is notsupported by this object.public void initialize(java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidAlgorithmParameterException
params
- the parameter set used to generate the keys.java.security.InvalidAlgorithmParameterException
- if the given parameters
are inappropriate for this key pair generator.public void initialize(java.security.spec.AlgorithmParameterSpec params, SecureRandom random) throws java.security.InvalidAlgorithmParameterException
params
- the parameter set used to generate the keys.random
- the source of randomness for this generator.java.security.InvalidAlgorithmParameterException
- if the given parameters
are inappropriate for this key pair generator.public java.security.KeyPair generateKeyPair()
public java.lang.String toString()
toString
in class java.lang.Object