Class PGPKeyPair
java.lang.Object
org.bouncycastle.openpgp.PGPKeyPair
- Direct Known Subclasses:
BcPGPKeyPair, JcaPGPKeyPair
Class to hold an unlocked PGP key pair.
Note: the private key might be null, e.g. for PGP keys with external/removed private key material.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPGPKeyPair(PGPPublicKey pub, PGPPrivateKey priv) Create a key pair from a PGPPrivateKey and a PGPPublicKey. -
Method Summary
Modifier and TypeMethodDescriptionasSubkey(KeyFingerPrintCalculator fingerPrintCalculator) Return this PGP key pair as a subkey pair.longgetKeyID()Return the keyID associated with this key pair.Return theKeyIdentifierassociated 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 theKeyIdentifierassociated with the public key.- Returns:
- key identifier
-
getPublicKey
-
getPrivateKey
-
asSubkey
Return this PGP key pair as a subkey pair. The public and private key packets get reconstructed into subkey packets.- Parameters:
fingerPrintCalculator- for fingerprint calculations- Returns:
- subkey pair
- Throws:
PGPException- if a subkey packet cannot be constructed properly
-