Package net.i2p.crypto.eddsa
Class KeyPairGenerator
java.lang.Object
java.security.KeyPairGeneratorSpi
net.i2p.crypto.eddsa.KeyPairGenerator
- Direct Known Subclasses:
RedKeyPairGenerator
public class KeyPairGenerator extends KeyPairGeneratorSpi
Default keysize is 256 (Ed25519)
- Since:
- 0.9.15
-
Field Summary
Fields Modifier and Type Field Description protected static int
DEFAULT_KEYSIZE
protected EdDSAParameterSpec
edParams
protected boolean
initialized
protected SecureRandom
random
-
Constructor Summary
Constructors Constructor Description KeyPairGenerator()
-
Method Summary
Modifier and Type Method Description protected EdDSANamedCurveSpec
createNamedCurveSpec(String curveName)
Create an EdDSANamedCurveSpec from the provided curve name.KeyPair
generateKeyPair()
void
initialize(int keysize, SecureRandom random)
void
initialize(AlgorithmParameterSpec params, SecureRandom random)
-
Field Details
-
DEFAULT_KEYSIZE
protected static final int DEFAULT_KEYSIZE- See Also:
- Constant Field Values
-
edParams
-
random
-
initialized
protected boolean initialized
-
-
Constructor Details
-
KeyPairGenerator
public KeyPairGenerator()
-
-
Method Details
-
initialize
- Specified by:
initialize
in classKeyPairGeneratorSpi
-
initialize
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException- Overrides:
initialize
in classKeyPairGeneratorSpi
- Throws:
InvalidAlgorithmParameterException
-
generateKeyPair
- Specified by:
generateKeyPair
in classKeyPairGeneratorSpi
-
createNamedCurveSpec
protected EdDSANamedCurveSpec createNamedCurveSpec(String curveName) throws InvalidAlgorithmParameterExceptionCreate an EdDSANamedCurveSpec from the provided curve name. The current implementation fetches the pre-created curve spec from a table.- Parameters:
curveName
- the EdDSA named curve.- Returns:
- the specification for the named curve.
- Throws:
InvalidAlgorithmParameterException
- if the named curve is unknown.
-