GeezerVison is showing docs.oracle.com — KeyPairGenerator (Java Platform SE 8 )
Java™ Platform Standard Ed. 8
compact1, compact2, compact3
java.security
Class KeyPairGenerator
-
-
Constructor Summary
Constructors
| Modifier |
Constructor |
Description |
protected |
KeyPairGenerator(String algorithm) |
Creates a KeyPairGenerator object for the specified algorithm.
|
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods
| Modifier and Type |
Method |
Description |
KeyPair |
generateKeyPair() |
Generates a key pair.
|
KeyPair |
genKeyPair() |
Generates a key pair.
|
String |
getAlgorithm() |
Returns the standard name of the algorithm for this key pair generator.
|
static KeyPairGenerator |
getInstance(String algorithm) |
Returns a KeyPairGenerator object that generates public/private
key pairs for the specified algorithm.
|
static KeyPairGenerator |
getInstance(String algorithm,
Provider provider) |
Returns a KeyPairGenerator object that generates public/private
key pairs for the specified algorithm.
|
static KeyPairGenerator |
getInstance(String algorithm,
String provider) |
Returns a KeyPairGenerator object that generates public/private
key pairs for the specified algorithm.
|
Provider |
getProvider() |
Returns the provider of this key pair generator object.
|
void |
initialize(AlgorithmParameterSpec params) |
Initializes the key pair generator using the specified parameter
set and the SecureRandom
implementation of the highest-priority installed provider as the source
of randomness.
|
void |
initialize(AlgorithmParameterSpec params,
SecureRandom random) |
Initializes the key pair generator with the given parameter
set and source of randomness.
|
void |
initialize(int keysize) |
Initializes the key pair generator for a certain keysize using
a default parameter set and the SecureRandom
implementation of the highest-priority installed provider as the source
of randomness.
|
void |
initialize(int keysize,
SecureRandom random) |
Initializes the key pair generator for a certain keysize with
the given source of randomness (and a default parameter set).
|
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
initialize
public void initialize(int keysize)
Initializes the key pair generator for a certain keysize using
a default parameter set and the SecureRandom
implementation of the highest-priority installed provider as the source
of randomness.
(If none of the installed providers supply an implementation of
SecureRandom, a system-provided source of randomness is
used.)
- Parameters:
keysize - the keysize. This is an
algorithm-specific metric, such as modulus length, specified in
number of bits.
- Throws:
InvalidParameterException - if the keysize is not
supported by this KeyPairGenerator object.
-
initialize
public void initialize(int keysize,
SecureRandom random)
Initializes the key pair generator for a certain keysize with
the given source of randomness (and a default parameter set).
- Specified by:
initialize in class KeyPairGeneratorSpi
- Parameters:
keysize - the keysize. This is an
algorithm-specific metric, such as modulus length, specified in
number of bits.
random - the source of randomness.
- Throws:
InvalidParameterException - if the keysize is not
supported by this KeyPairGenerator object.
- Since:
- 1.2
Java™ Platform Standard Ed. 8
Submit a bug or feature For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright © 1993, 2026, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
|