Top Description Fields Constructors Methods
org.conscrypt

public final Class OpenSSLRSAKeyPairGenerator

extends KeyPairGeneratorSpi
Class Inheritance
Annotations
@Internal
Imports
java.math.BigInteger, java.security.InvalidAlgorithmParameterException, .KeyPair, .KeyPairGeneratorSpi, .PrivateKey, .PublicKey, .SecureRandom, java.security.spec.AlgorithmParameterSpec, .RSAKeyGenParameterSpec

An implementation of java.security.KeyPairGenerator which uses BoringSSL to perform all the operations.

Field Summary

Modifier and TypeField and Description
private int
modulusBits

Default RSA key size 2048 bits.

private byte[]
publicExponent

Default modulus size is 0x10001 (65537)

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public KeyPair
generateKeyPair()

Implements abstract java.security.KeyPairGeneratorSpi.generateKeyPair.

Generates a key pair.
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

modulusBitsback to summary
private int modulusBits

Default RSA key size 2048 bits.

publicExponentback to summary
private byte[] publicExponent

Default modulus size is 0x10001 (65537)

Constructor Detail

OpenSSLRSAKeyPairGeneratorback to summary
public OpenSSLRSAKeyPairGenerator()

Method Detail

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
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.