Top Inners Fields Constructors Methods
org.bouncycastle.openpgp.operator.bc

public Class BcPGPKeyPairGeneratorProvider

extends PGPKeyPairGeneratorProvider
Class Inheritance
Imports
org.bouncycastle.bcpg.PublicKeyAlgorithmTags, .PublicKeyPacket, org.bouncycastle.crypto.AsymmetricCipherKeyPair, .CryptoServicesRegistrar, org.bouncycastle.crypto.generators.Ed25519KeyPairGenerator, .Ed448KeyPairGenerator, .RSAKeyPairGenerator, .X25519KeyPairGenerator, .X448KeyPairGenerator, org.bouncycastle.crypto.params.Ed25519KeyGenerationParameters, .Ed448KeyGenerationParameters, .RSAKeyGenerationParameters, .X25519KeyGenerationParameters, .X448KeyGenerationParameters, org.bouncycastle.openpgp.PGPException, .PGPKeyPair, org.bouncycastle.openpgp.operator.PGPKeyPairGenerator, .PGPKeyPairGeneratorProvider, java.math.BigInteger, java.security.SecureRandom, java.util.Date

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private SecureRandom

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public PGPKeyPairGenerator
get(int version, Date creationTime)

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGeneratorProvider.get.

public BcPGPKeyPairGeneratorProvider

Field Detail

randomback to summary
private SecureRandom random

Constructor Detail

BcPGPKeyPairGeneratorProviderback to summary
public BcPGPKeyPairGeneratorProvider()

Method Detail

getback to summary
public PGPKeyPairGenerator get(int version, Date creationTime)

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGeneratorProvider.get.

Annotations
@Override
setSecureRandomback to summary
public BcPGPKeyPairGeneratorProvider setSecureRandom(SecureRandom random)
org.bouncycastle.openpgp.operator.bc back to summary

private Class BcPGPKeyPairGeneratorProvider.BcPGPKeyPairGenerator

extends PGPKeyPairGenerator
Class Inheritance

Field Summary

Inherited from org.bouncycastle.openpgp.operator.PGPKeyPairGenerator:
creationTimefingerPrintCalculatorrandomversion

Constructor Summary

AccessConstructor and Description
public
BcPGPKeyPairGenerator(int version, Date creationTime, SecureRandom random)

Method Summary

Modifier and TypeMethod and Description
public PGPKeyPair
generateEd25519KeyPair()

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateEd25519KeyPair.

Generate an elliptic curve signing key over the twisted Edwards curve25519.

public PGPKeyPair
generateEd448KeyPair()

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateEd448KeyPair.

Generate an elliptic curve signing key over the twisted Edwards curve448.

public PGPKeyPair
generateLegacyEd25519KeyPair()

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateLegacyEd25519KeyPair.

Generate a legacy elliptic curve signing key pair over the twisted Edwards curve25519.

public PGPKeyPair
generateLegacyX25519KeyPair()

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateLegacyX25519KeyPair.

Generate a legacy elliptic curve Diffie-Hellman encryption key pair over curve25519.

public PGPKeyPair
generateRsaKeyPair(BigInteger
RSA exponent
e
exponent
,
int
strength of the key pair in bits
bitStrength
)

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateRsaKeyPair.

Generate a RSA key pair with the given bit-strength over a custom exponent.

public PGPKeyPair
generateX25519KeyPair()

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateX25519KeyPair.

Generate an elliptic curve Diffie-Hellman encryption key over curve25519.

public PGPKeyPair
generateX448KeyPair()

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateX448KeyPair.

Generate an elliptic curve Diffie-Hellman encryption key over curve448.

Inherited from org.bouncycastle.openpgp.operator.PGPKeyPairGenerator:
generateEncryptionSubkeygeneratePrimaryKeygenerateRsaKeyPairgenerateSigningSubkey

Constructor Detail

BcPGPKeyPairGeneratorback to summary
public BcPGPKeyPairGenerator(int version, Date creationTime, SecureRandom random)

Method Detail

generateEd25519KeyPairback to summary
public PGPKeyPair generateEd25519KeyPair() throws PGPException

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateEd25519KeyPair.

Doc from org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateEd25519KeyPair.

Generate an elliptic curve signing key over the twisted Edwards curve25519. The key will use PublicKeyAlgorithmTags#Ed25519 which was introduced with RFC9580. For legacy Ed25519 keys use generateLegacyEd25519KeyPair().

Returns:PGPKeyPair

Ed25519 key pair

Annotations
@Override
Exceptions
PGPException:
if the key pair cannot be generated
generateEd448KeyPairback to summary
public PGPKeyPair generateEd448KeyPair() throws PGPException

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateEd448KeyPair.

Doc from org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateEd448KeyPair.

Generate an elliptic curve signing key over the twisted Edwards curve448. The key will use PublicKeyAlgorithmTags#Ed448 which was introduced with RFC9580.

Returns:PGPKeyPair

Ed448 signing key pair

Annotations
@Override
Exceptions
PGPException:
if the key pair cannot be generated
generateLegacyEd25519KeyPairback to summary
public PGPKeyPair generateLegacyEd25519KeyPair() throws PGPException

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateLegacyEd25519KeyPair.

Doc from org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateLegacyEd25519KeyPair.

Generate a legacy elliptic curve signing key pair over the twisted Edwards curve25519. Legacy keys have good application support, but MUST NOT be used as OpenPGP v6 keys. The key will use PublicKeyAlgorithmTags#EDDSA_LEGACY as algorithm ID. For OpenPGP v6 (RFC9580) use generateEd25519KeyPair() instead.

Returns:PGPKeyPair

legacy Ed25519 key pair

Annotations
@Override
Exceptions
PGPException:
if the key pair cannot be generated
generateLegacyX25519KeyPairback to summary
public PGPKeyPair generateLegacyX25519KeyPair() throws PGPException

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateLegacyX25519KeyPair.

Doc from org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateLegacyX25519KeyPair.

Generate a legacy elliptic curve Diffie-Hellman encryption key pair over curve25519. Legacy keys have good application support, but MUST NOT be used as OpenPGP v6 keys. The key will use PublicKeyAlgorithmTags#ECDH as algorithm ID. For OpenPGP v6 (RFC9580) use generateX25519KeyPair() instead.

Returns:PGPKeyPair

legacy X25519 key pair

Annotations
@Override
Exceptions
PGPException:
if the key pair cannot be generated
generateRsaKeyPairback to summary
public PGPKeyPair generateRsaKeyPair(BigInteger exponent, int bitStrength) throws PGPException

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateRsaKeyPair.

Doc from org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateRsaKeyPair.

Generate a RSA key pair with the given bit-strength over a custom exponent. It is recommended to use at least 2048 bits or more. RSA keys are deprecated for OpenPGP v6.

Parameters
exponent:BigInteger

RSA exponent

e
bitStrength:int

strength of the key pair in bits

Returns:PGPKeyPair

rsa key pair

Annotations
@Override
Exceptions
PGPException:
if the key pair cannot be generated
generateX25519KeyPairback to summary
public PGPKeyPair generateX25519KeyPair() throws PGPException

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateX25519KeyPair.

Doc from org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateX25519KeyPair.

Generate an elliptic curve Diffie-Hellman encryption key over curve25519. THe key will use PublicKeyAlgorithmTags#X25519 which was introduced with RFC9580. For legacy X25519 keys use generateLegacyX25519KeyPair() instead.

Returns:PGPKeyPair

X25519 encryption key pair

Annotations
@Override
Exceptions
PGPException:
if the key pair cannot be generated
generateX448KeyPairback to summary
public PGPKeyPair generateX448KeyPair() throws PGPException

Implements abstract org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateX448KeyPair.

Doc from org.bouncycastle.openpgp.operator.PGPKeyPairGenerator.generateX448KeyPair.

Generate an elliptic curve Diffie-Hellman encryption key over curve448. THe key will use PublicKeyAlgorithmTags#X448 which was introduced with RFC9580.

Returns:PGPKeyPair

X448 encryption key pair

Annotations
@Override
Exceptions
PGPException:
if the key pair cannot be generated