Top Description Fields Constructors Methods
org.bouncycastle.openpgp

public Class PGPKeyRingGenerator

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Iterator, .List, org.bouncycastle.bcpg.PublicSubkeyPacket, .SignatureSubpacket, .SignatureSubpacketTags, org.bouncycastle.openpgp.operator.PBESecretKeyDecryptor, .PBESecretKeyEncryptor, .PGPContentSignerBuilder, .PGPDigestCalculator

Generator for a PGP master and subkey ring. This class will generate both the secret and public key rings

Field Summary

Modifier and TypeField and Description
private PGPDigestCalculator
private PGPSignatureSubpacketVector
private PBESecretKeyEncryptor
pack-priv List<E>
private PGPContentSignerBuilder
private PGPKeyPair
private PGPSignatureSubpacketVector

Constructor Summary

AccessConstructor and Description
public
PGPKeyRingGenerator(int certificationLevel, PGPKeyPair masterKey, String
id to associate with the key.
id
,
PGPDigestCalculator
key checksum calculator
checksumCalculator
,
PGPSignatureSubpacketVector hashedPcks, PGPSignatureSubpacketVector unhashedPcks, PGPContentSignerBuilder
builder for key certifications - will be initialised with master secret key.
keySignerBuilder
,
PBESecretKeyEncryptor
encryptor for secret subkeys.
keyEncryptor
)

Create a new key ring generator.

public
PGPKeyRingGenerator(PGPKeyPair
primary key
masterKey
,
PGPDigestCalculator
checksum calculator
checksumCalculator
,
PGPSignatureSubpacketVector
hashed signature subpackets
hashedPcks
,
PGPSignatureSubpacketVector
unhashed signature subpackets
unhashedPcks
,
PGPContentSignerBuilder
signer builder
keySignerBuilder
,
PBESecretKeyEncryptor
key encryptor
keyEncryptor
)

Create a new key ring generator without a user-id, but instead with a primary key carrying a direct-key signature.

public
PGPKeyRingGenerator(PGPSecretKeyRing
the secret key ring we want to add a subkeyto,
originalSecretRing
,
PBESecretKeyDecryptor
a decryptor for the signing master key.
secretKeyDecryptor
,
PGPDigestCalculator
key checksum calculator
checksumCalculator
,
PGPContentSignerBuilder
builder for key certifications - will be initialised with master secret key.
keySignerBuilder
,
PBESecretKeyEncryptor
encryptor for secret subkeys.
keyEncryptor
)

Create a new key ring generator based on an original secret key ring.

Method Summary

Modifier and TypeMethod and Description
public void
addSubKey(PGPKeyPair
the key pair to add.
keyPair
)

Add a sub key to the key ring to be generated with default certification and inheriting the hashed/unhashed packets of the master key.

public void
addSubKey(PGPKeyPair
the key pair to add.
keyPair
,
PGPContentSignerBuilder
provide a signing builder to create the Primary Key signature.
bindingSignerBldr
)

Add a sub key to the key ring to be generated with default certification and inheriting the hashed/unhashed packets of the master key.

public void
addSubKey(PGPKeyPair
public/private key pair.
keyPair
,
PGPSignatureSubpacketVector
hashed packet values to be included in certification.
hashedPcks
,
PGPSignatureSubpacketVector
unhashed packets values to be included in certification.
unhashedPcks
)

Add a subkey with specific hashed and unhashed packets associated with it and default certification.

public void
addSubKey(PGPKeyPair
public/private key pair.
keyPair
,
PGPSignatureSubpacketVector
hashed packet values to be included in certification.
hashedPcks
,
PGPSignatureSubpacketVector
unhashed packets values to be included in certification.
unhashedPcks
,
PGPContentSignerBuilder
provide a signing builder to create the Primary Key signature.
bindingSignerBldr
)

Add a subkey with specific hashed and unhashed packets associated with it and default certification.

public PGPPublicKeyRing

Returns:

a public key ring.
generatePublicKeyRing
()

Return the public key ring that corresponds to the secret key ring.

public PGPSecretKeyRing

Returns:

a secret key ring.
generateSecretKeyRing
()

Return the secret key ring.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

checksumCalculatorback to summary
private PGPDigestCalculator checksumCalculator
hashedPcksback to summary
private PGPSignatureSubpacketVector hashedPcks
keyEncryptorback to summary
private PBESecretKeyEncryptor keyEncryptor
keysback to summary
pack-priv List<E> keys
keySignerBuilderback to summary
private PGPContentSignerBuilder keySignerBuilder
masterKeyback to summary
private PGPKeyPair masterKey
unhashedPcksback to summary
private PGPSignatureSubpacketVector unhashedPcks

Constructor Detail

PGPKeyRingGeneratorback to summary
public PGPKeyRingGenerator(int certificationLevel, PGPKeyPair masterKey, String id, PGPDigestCalculator checksumCalculator, PGPSignatureSubpacketVector hashedPcks, PGPSignatureSubpacketVector unhashedPcks, PGPContentSignerBuilder keySignerBuilder, PBESecretKeyEncryptor keyEncryptor) throws PGPException

Create a new key ring generator.

Parameters
id:String

id to associate with the key.

checksumCalculator:PGPDigestCalculator

key checksum calculator

keySignerBuilder:PGPContentSignerBuilder

builder for key certifications - will be initialised with master secret key.

keyEncryptor:PBESecretKeyEncryptor

encryptor for secret subkeys.

PGPKeyRingGeneratorback to summary
public PGPKeyRingGenerator(PGPKeyPair masterKey, PGPDigestCalculator checksumCalculator, PGPSignatureSubpacketVector hashedPcks, PGPSignatureSubpacketVector unhashedPcks, PGPContentSignerBuilder keySignerBuilder, PBESecretKeyEncryptor keyEncryptor) throws PGPException

Create a new key ring generator without a user-id, but instead with a primary key carrying a direct-key signature.

Parameters
masterKey:PGPKeyPair

primary key

checksumCalculator:PGPDigestCalculator

checksum calculator

hashedPcks:PGPSignatureSubpacketVector

hashed signature subpackets

unhashedPcks:PGPSignatureSubpacketVector

unhashed signature subpackets

keySignerBuilder:PGPContentSignerBuilder

signer builder

keyEncryptor:PBESecretKeyEncryptor

key encryptor

PGPKeyRingGeneratorback to summary
public PGPKeyRingGenerator(PGPSecretKeyRing originalSecretRing, PBESecretKeyDecryptor secretKeyDecryptor, PGPDigestCalculator checksumCalculator, PGPContentSignerBuilder keySignerBuilder, PBESecretKeyEncryptor keyEncryptor) throws PGPException

Create a new key ring generator based on an original secret key ring. The default hashed/unhashed sub-packets for subkey signatures will be inherited from the first signature on the master key (other than CREATION-TIME which will be ignored).

Parameters
originalSecretRing:PGPSecretKeyRing

the secret key ring we want to add a subkeyto,

secretKeyDecryptor:PBESecretKeyDecryptor

a decryptor for the signing master key.

checksumCalculator:PGPDigestCalculator

key checksum calculator

keySignerBuilder:PGPContentSignerBuilder

builder for key certifications - will be initialised with master secret key.

keyEncryptor:PBESecretKeyEncryptor

encryptor for secret subkeys.

Method Detail

addSubKeyback to summary
public void addSubKey(PGPKeyPair keyPair) throws PGPException

Add a sub key to the key ring to be generated with default certification and inheriting the hashed/unhashed packets of the master key.

Parameters
keyPair:PGPKeyPair

the key pair to add.

addSubKeyback to summary
public void addSubKey(PGPKeyPair keyPair, PGPContentSignerBuilder bindingSignerBldr) throws PGPException

Add a sub key to the key ring to be generated with default certification and inheriting the hashed/unhashed packets of the master key. If bindingSignerBldr is not null it will be used to add a Primary Key Binding signature (type 0x19) into the hashedPcks for the key (required for signing subkeys).

Parameters
keyPair:PGPKeyPair

the key pair to add.

bindingSignerBldr:PGPContentSignerBuilder

provide a signing builder to create the Primary Key signature.

addSubKeyback to summary
public void addSubKey(PGPKeyPair keyPair, PGPSignatureSubpacketVector hashedPcks, PGPSignatureSubpacketVector unhashedPcks) throws PGPException

Add a subkey with specific hashed and unhashed packets associated with it and default certification.

Parameters
keyPair:PGPKeyPair

public/private key pair.

hashedPcks:PGPSignatureSubpacketVector

hashed packet values to be included in certification.

unhashedPcks:PGPSignatureSubpacketVector

unhashed packets values to be included in certification.

addSubKeyback to summary
public void addSubKey(PGPKeyPair keyPair, PGPSignatureSubpacketVector hashedPcks, PGPSignatureSubpacketVector unhashedPcks, PGPContentSignerBuilder bindingSignerBldr) throws PGPException

Add a subkey with specific hashed and unhashed packets associated with it and default certification. If bindingSignerBldr is not null it will be used to add a Primary Key Binding signature (type 0x19) into the hashedPcks for the key (required for signing subkeys).

Parameters
keyPair:PGPKeyPair

public/private key pair.

hashedPcks:PGPSignatureSubpacketVector

hashed packet values to be included in certification.

unhashedPcks:PGPSignatureSubpacketVector

unhashed packets values to be included in certification.

bindingSignerBldr:PGPContentSignerBuilder

provide a signing builder to create the Primary Key signature.

generatePublicKeyRingback to summary
public PGPPublicKeyRing generatePublicKeyRing()

Return the public key ring that corresponds to the secret key ring.

Returns:PGPPublicKeyRing

a public key ring.

generateSecretKeyRingback to summary
public PGPSecretKeyRing generateSecretKeyRing()

Return the secret key ring.

Returns:PGPSecretKeyRing

a secret key ring.