org.bouncycastle.openpgp

Class PGPKeyPair

public class PGPKeyPair extends Object

General class to handle JCA key pairs and convert them into OpenPGP ones.

A word for the unwary, the KeyID for a OpenPGP public key is calculated from a hash that includes the time of creation, if you pass a different date to the constructor below with the same public private key pair the KeyID will not be the same as for previous generations of the key, so ideally you only want to do this once.

Constructor Summary
PGPKeyPair(int algorithm, KeyPair keyPair, Date time, String provider)
PGPKeyPair(int algorithm, PublicKey pubKey, PrivateKey privKey, Date time, String provider)
PGPKeyPair(PGPPublicKey pub, PGPPrivateKey priv)
Create a key pair from a PGPPrivateKey and a PGPPublicKey.
Method Summary
longgetKeyID()
Return the keyID associated with this key pair.
PGPPrivateKeygetPrivateKey()
PGPPublicKeygetPublicKey()

Constructor Detail

PGPKeyPair

public PGPKeyPair(int algorithm, KeyPair keyPair, Date time, String provider)

PGPKeyPair

public PGPKeyPair(int algorithm, PublicKey pubKey, PrivateKey privKey, Date time, String provider)

PGPKeyPair

public PGPKeyPair(PGPPublicKey pub, PGPPrivateKey priv)
Create a key pair from a PGPPrivateKey and a PGPPublicKey.

Parameters: pub the public key priv the private key

Method Detail

getKeyID

public long getKeyID()
Return the keyID associated with this key pair.

Returns: keyID

getPrivateKey

public PGPPrivateKey getPrivateKey()

getPublicKey

public PGPPublicKey getPublicKey()