org.bouncycastle.openpgp

Class PGPKeyRingGenerator


public class PGPKeyRingGenerator
extends java.lang.Object

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

Constructor Summary

PGPKeyRingGenerator(int certificationLevel, PGPKeyPair masterKey, String id, int encAlgorithm, char[] passPhrase, PGPSignatureSubpacketVector hashedPcks, PGPSignatureSubpacketVector unhashedPcks, SecureRandom rand, String provider)
Create a new key ring generator.

Method Summary

void
addSubKey(PGPKeyPair keyPair)
Add a sub key to the key ring to be generated with default certification.
PGPPublicKeyRing
generatePublicKeyRing()
Return the public key ring that corresponds to the secret key ring.
PGPSecretKeyRing
generateSecretKeyRing()
Return the secret key ring.

Constructor Details

PGPKeyRingGenerator

public PGPKeyRingGenerator(int certificationLevel,
                           PGPKeyPair masterKey,
                           String id,
                           int encAlgorithm,
                           char[] passPhrase,
                           PGPSignatureSubpacketVector hashedPcks,
                           PGPSignatureSubpacketVector unhashedPcks,
                           SecureRandom rand,
                           String provider)
            throws PGPException,
                   NoSuchProviderException
Create a new key ring generator.

Parameters:
certificationLevel - the certification level for keys on this ring.
masterKey - the master key pair.
id - the id to be associated with the ring.
encAlgorithm - the algorithm to be used to protect secret keys.
passPhrase - the passPhrase to be used to protect secret keys.
hashedPcks - packets to be include in the certification hash.
unhashedPcks - packets to be attached unhashed to the certification.
rand - input secured random
provider - the provider to use for encryption.

Throws:
PGPException -

Method Details

addSubKey

public void addSubKey(PGPKeyPair keyPair)
            throws PGPException
Add a sub key to the key ring to be generated with default certification.

Parameters:
keyPair -

Throws:
PGPException -


generatePublicKeyRing

public PGPPublicKeyRing generatePublicKeyRing()
Return the public key ring that corresponds to the secret key ring.

Returns:
a public key ring.


generateSecretKeyRing

public PGPSecretKeyRing generateSecretKeyRing()
Return the secret key ring.

Returns:
a secret key ring.