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
All Methods Instance Methods Concrete Methods 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 Detail
-
DEFAULT_KEYSIZE
protected static final int DEFAULT_KEYSIZE
- See Also:
- Constant Field Values
-
edParams
protected EdDSAParameterSpec edParams
-
random
protected SecureRandom random
-
initialized
protected boolean initialized
-
-
Method Detail
-
initialize
public void initialize(int keysize, SecureRandom random)
- Specified by:
initialize
in classKeyPairGeneratorSpi
-
initialize
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException
- Overrides:
initialize
in classKeyPairGeneratorSpi
- Throws:
InvalidAlgorithmParameterException
-
generateKeyPair
public KeyPair generateKeyPair()
- Specified by:
generateKeyPair
in classKeyPairGeneratorSpi
-
createNamedCurveSpec
protected EdDSANamedCurveSpec createNamedCurveSpec(String curveName) throws InvalidAlgorithmParameterException
Create 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.
-
-