Package org.bouncycastle.openpgp
Class PGPKeyPair
java.lang.Object
org.bouncycastle.openpgp.PGPKeyPair
- Direct Known Subclasses:
BcPGPKeyPair
,JcaPGPKeyPair
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
-
Constructor Summary
ModifierConstructorDescriptionprotected
PGPKeyPair
(PGPPublicKey pub, PGPPrivateKey priv) Create a key pair from a PGPPrivateKey and a PGPPublicKey. -
Method Summary
Modifier and TypeMethodDescriptionlong
getKeyID()
Return the keyID associated with this key pair.Return theKeyIdentifier
associated with the public key.
-
Field Details
-
pub
-
priv
-
-
Constructor Details
-
PGPKeyPair
Create a key pair from a PGPPrivateKey and a PGPPublicKey.- Parameters:
pub
- the public keypriv
- the private key
-
PGPKeyPair
protected PGPKeyPair()
-
-
Method Details
-
getKeyID
public long getKeyID()Return the keyID associated with this key pair.- Returns:
- keyID
-
getKeyIdentifier
Return theKeyIdentifier
associated with the public key.- Returns:
- key identifier
-
getPublicKey
-
getPrivateKey
-