org.bouncycastle.openpgp
Class PGPPublicKeyRing
public class PGPPublicKeyRing
Class to hold a single master public key and its subkeys.
Often PGP keyring files consist of multiple master keys, if you are trying to process
or construct one of these you should use the PGPPublicKeyRingCollection class.
PGPPublicKeyRing
public PGPPublicKeyRing(InputStream in)
throws IOException
PGPPublicKeyRing
public PGPPublicKeyRing(byte[] encoding)
throws IOException
encode
public void encode(OutputStream outStream)
throws IOException
getEncoded
public byte[] getEncoded()
throws IOException
getPublicKey
public PGPPublicKey getPublicKey()
Return the first public key in the ring.
getPublicKey
public PGPPublicKey getPublicKey(long keyID)
throws PGPException
Return the public key referred to by the passed in keyID if it
is present.
getPublicKeys
public Iterator getPublicKeys()
Return an iterator containing all the public keys.
insertPublicKey
public static PGPPublicKeyRing insertPublicKey(PGPPublicKeyRing pubRing,
PGPPublicKey pubKey)
Returns a new key ring with the public key passed in
either added or replacing an existing one.
pubRing
- the public key ring to be modifiedpubKey
- the public key to be inserted.
removePublicKey
public static PGPPublicKeyRing removePublicKey(PGPPublicKeyRing pubRing,
PGPPublicKey pubKey)
Returns a new key ring with the public key passed in
removed from the key ring.
pubRing
- the public key ring to be modifiedpubKey
- the public key to be removed.
- a new keyRing, null if pubKey is not found.