java.lang.Object
java.security.KeyPairGeneratorSpi
net.i2p.crypto.elgamal.KeyPairGenerator
Modified from eddsa Only supported strength is 2048.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intBits in the prime generated by default.private ElGamalParameterSpecThe p and g parameters in use.private booleanTrue once the parameters have been set.Constructor Summary
ConstructorsMethod Summary
All MethodsModifier and TypeMethodDescriptionvoidinitialize(int strength, SecureRandom random) Initialize the key pair generator with the specified strength.voidinitialize(AlgorithmParameterSpec params, SecureRandom random) Initialize the key pair generator with the specified parameters.
Field Details
DEFAULT_STRENGTH
private static final int DEFAULT_STRENGTHBits in the prime generated by default. Always long - the short key is not used.- See Also:
elgParams
The p and g parameters in use.initialized
private boolean initializedTrue once the parameters have been set.
Constructor Details
KeyPairGenerator
public KeyPairGenerator()Constructor. The JCA framework callsinitialize(int, SecureRandom)with the strength, so the instance starts uninitialized with no parameters set.
Method Details
initialize
Initialize the key pair generator with the specified strength.- Specified by:
initializein classKeyPairGeneratorSpi- Parameters:
strength- must be 2048random- accepted to satisfy theKeyPairGeneratorcontract and ignored
initialize
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException Initialize the key pair generator with the specified parameters.- Overrides:
initializein classKeyPairGeneratorSpi- Parameters:
random- accepted to satisfy theKeyPairGeneratorcontract and ignored- Throws:
InvalidAlgorithmParameterException
generateKeyPair
- Specified by:
generateKeyPairin classKeyPairGeneratorSpi