Top Description Fields Constructors Methods
sun.security.ec

public final Class ECKeyPairGenerator

extends KeyPairGeneratorSpi
Class Inheritance
Imports
java.security.*, java.security.spec.AlgorithmParameterSpec, .ECGenParameterSpec, .ECParameterSpec, .ECPoint, .InvalidParameterSpecException, java.util.Arrays, .Optional, sun.security.jca.JCAUtil, sun.security.util.ECUtil, sun.security.util.math.*, sun.security.ec.point.*

EC keypair generator. Standard algorithm, minimum key length is 112 bits, maximum is 571 bits.
Since
1.7

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private int
private AlgorithmParameterSpec
private SecureRandom

Constructor Summary

AccessConstructor and Description
public
ECKeyPairGenerator()

Constructs a new ECKeyPairGenerator.

Method Summary

Modifier and TypeMethod and Description
private void
checkKeySize(int keySize)

private static void
public KeyPair
generateKeyPair()

Implements abstract java.security.KeyPairGeneratorSpi.generateKeyPair.

Generates a key pair.
private Optional<KeyPair>
private byte[]
generatePrivateScalar(SecureRandom random, ECOperations ecOps, int seedSize)

public void
initialize(int
the keysize. This is an algorithm-specific metric, such as modulus length, specified in number of bits.
keySize
,
SecureRandom
the source of randomness for this generator.
random
)

Implements abstract java.security.KeyPairGeneratorSpi.initialize.

Initializes the key pair generator for a certain keysize, using the default parameter set.
public void
initialize(AlgorithmParameterSpec
the parameter set used to generate the keys.
params
,
SecureRandom
the source of randomness for this generator.
random
)

Overrides java.security.KeyPairGeneratorSpi.initialize.

Initializes the key pair generator using the specified parameter set and user-provided source of randomness.

Field Detail

KEY_SIZE_MAXback to summary
private static final int KEY_SIZE_MAX
KEY_SIZE_MINback to summary
private static final int KEY_SIZE_MIN
keySizeback to summary
private int keySize
paramsback to summary
private AlgorithmParameterSpec params
randomback to summary
private SecureRandom random

Constructor Detail

ECKeyPairGeneratorback to summary
public ECKeyPairGenerator()

Constructs a new ECKeyPairGenerator.

Method Detail

checkKeySizeback to summary
private void checkKeySize(int keySize) throws InvalidParameterException
ensureCurveIsSupportedback to summary
private static void ensureCurveIsSupported(ECParameterSpec ecSpec) throws InvalidAlgorithmParameterException
generateKeyPairback to summary
public KeyPair generateKeyPair()

Implements abstract java.security.KeyPairGeneratorSpi.generateKeyPair.

Doc from java.security.KeyPairGeneratorSpi.generateKeyPair.

Generates a key pair. Unless an initialization method is called using a KeyPairGenerator interface, algorithm-specific defaults will be used. This will generate a new key pair every time it is called.

Returns:KeyPair

the newly generated KeyPair

Annotations
@Override
generateKeyPairImplback to summary
private Optional<KeyPair> generateKeyPairImpl(SecureRandom random) throws InvalidKeyException
generatePrivateScalarback to summary
private byte[] generatePrivateScalar(SecureRandom random, ECOperations ecOps, int seedSize)
initializeback to summary
public void initialize(int keySize, SecureRandom random)

Implements abstract java.security.KeyPairGeneratorSpi.initialize.

Doc from java.security.KeyPairGeneratorSpi.initialize.

Initializes the key pair generator for a certain keysize, using the default parameter set.

Parameters
keySize:int

the keysize. This is an algorithm-specific metric, such as modulus length, specified in number of bits.

random:SecureRandom

the source of randomness for this generator.

Annotations
@Override
initializeback to summary
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException

Overrides java.security.KeyPairGeneratorSpi.initialize.

Doc from java.security.KeyPairGeneratorSpi.initialize.

Initializes the key pair generator using the specified parameter set and user-provided source of randomness.

This concrete method has been added to this previously-defined abstract class. (For backwards compatibility, it cannot be abstract.) It may be overridden by a provider to initialize the key pair generator. Such an override is expected to throw an InvalidAlgorithmParameterException if a parameter is inappropriate for this key pair generator. If this method is not overridden, it always throws an UnsupportedOperationException.

Parameters
params:AlgorithmParameterSpec

the parameter set used to generate the keys.

random:SecureRandom

the source of randomness for this generator.

Annotations
@Override
Exceptions
InvalidAlgorithmParameterException:
if the given parameters are inappropriate for this key pair generator.