de.flexiprovider.core.elgamal.semanticallysecure
Class SSVElGamalKeyPairGenerator
java.lang.Object
|
+--java.security.KeyPairGeneratorSpi
|
+--de.flexiprovider.api.keys.KeyPairGenerator
|
+--de.flexiprovider.core.elgamal.semanticallysecure.SSVElGamalKeyPairGenerator
- public class SSVElGamalKeyPairGenerator
- extends KeyPairGenerator
This class is used to generate key pairs for the semantically secure variant
of the ElGamal encryption algorithm (implemented by SSVElGamal). It
can be initialized with the bit length of the prime p. The default
bit length of the prime p is 1024 bits.
- Author:
- Thomas Wahrenbruch, Martin Döring, Roberto Samarone dos Santos Araújo
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SSVElGamalKeyPairGenerator
public SSVElGamalKeyPairGenerator()
initialize
public void initialize(AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidAlgorithmParameterException
- Initialize the key pair generator with the specified parameters and
source of randomness. If the parameters are null, the
default
parameters are used.
- Overrides:
initialize in class KeyPairGenerator
- Parameters:
params - the parametersrandom - the source of randomness- Throws:
InvalidAlgorithmParameterException - if the parameters are not an instance of
SSVElGamalKeyGenParameterSpec.
initialize
public void initialize(int keySize,
SecureRandom random)
- Initialize the key pair generator with the specified key size and source
of randomness.
- Overrides:
initialize in class KeyPairGenerator
- Parameters:
keySize - the bit length of the prime prandom - the source of randomness
genKeyPair
public KeyPair genKeyPair()
- Generate a key pair, containing an
SSVElGamalPublicKey and an
SSVElGamalPrivateKey.
The prime p is always of the form 2*q+1. The algorithm
generates a prime number q and computes p = 2*q+1 until
p is prime. Then, a generator of the group (Z/pZ)* is
generated. In the last step, a random number a with
0 < a < p-2, is chosen. The public key parameters are
A = ga mod p, p, and g. The private
key parameters are a, p, and g.
- Overrides:
genKeyPair in class KeyPairGenerator
- Returns:
- the generated key pair