Bouncy Castle Cryptography Library 1.49

org.bouncycastle.openpgp
Class PGPKeyPair

java.lang.Object
  extended by org.bouncycastle.openpgp.PGPKeyPair
Direct Known Subclasses:
BcPGPKeyPair, JcaPGPKeyPair

public class PGPKeyPair
extends java.lang.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.


Field Summary
protected  PGPPrivateKey priv
           
protected  PGPPublicKey pub
           
 
Constructor Summary
protected PGPKeyPair()
           
  PGPKeyPair(int algorithm, java.security.KeyPair keyPair, java.util.Date time)
          Deprecated. use BcPGPKeyPair or JcaPGPKeyPair as appropriate.
  PGPKeyPair(int algorithm, java.security.KeyPair keyPair, java.util.Date time, java.lang.String provider)
          Deprecated. use BcPGPKeyPair or JcaPGPKeyPair as appropriate.
  PGPKeyPair(int algorithm, java.security.PublicKey pubKey, java.security.PrivateKey privKey, java.util.Date time)
          Deprecated. use BcPGPKeyPair or JcaPGPKeyPair as appropriate.
  PGPKeyPair(int algorithm, java.security.PublicKey pubKey, java.security.PrivateKey privKey, java.util.Date time, java.lang.String provider)
          Deprecated. use BcPGPKeyPair or JcaPGPKeyPair as appropriate.
  PGPKeyPair(PGPPublicKey pub, PGPPrivateKey priv)
          Create a key pair from a PGPPrivateKey and a PGPPublicKey.
 
Method Summary
 long getKeyID()
          Return the keyID associated with this key pair.
 PGPPrivateKey getPrivateKey()
           
 PGPPublicKey getPublicKey()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pub

protected PGPPublicKey pub

priv

protected PGPPrivateKey priv
Constructor Detail

PGPKeyPair

public PGPKeyPair(int algorithm,
                  java.security.KeyPair keyPair,
                  java.util.Date time,
                  java.lang.String provider)
           throws PGPException,
                  java.security.NoSuchProviderException
Deprecated. use BcPGPKeyPair or JcaPGPKeyPair as appropriate.

Throws:
PGPException
java.security.NoSuchProviderException

PGPKeyPair

public PGPKeyPair(int algorithm,
                  java.security.KeyPair keyPair,
                  java.util.Date time)
           throws PGPException
Deprecated. use BcPGPKeyPair or JcaPGPKeyPair as appropriate.

Throws:
PGPException

PGPKeyPair

public PGPKeyPair(int algorithm,
                  java.security.PublicKey pubKey,
                  java.security.PrivateKey privKey,
                  java.util.Date time,
                  java.lang.String provider)
           throws PGPException,
                  java.security.NoSuchProviderException
Deprecated. use BcPGPKeyPair or JcaPGPKeyPair as appropriate.

Throws:
PGPException
java.security.NoSuchProviderException

PGPKeyPair

public PGPKeyPair(int algorithm,
                  java.security.PublicKey pubKey,
                  java.security.PrivateKey privKey,
                  java.util.Date time)
           throws PGPException
Deprecated. use BcPGPKeyPair or JcaPGPKeyPair as appropriate.

Throws:
PGPException

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

PGPKeyPair

protected PGPKeyPair()
Method Detail

getKeyID

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

Returns:
keyID

getPublicKey

public PGPPublicKey getPublicKey()

getPrivateKey

public PGPPrivateKey getPrivateKey()

Bouncy Castle Cryptography Library 1.49