org.bouncycastle.openpgp
Class PGPPublicKeyRing
java.lang.Object
org.bouncycastle.openpgp.PGPPublicKeyRing
public class PGPPublicKeyRing
extends java.lang.Object
general class to hold a collection of PGP Public Keys.
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.
- PGPPublicKey
getPublicKey
public PGPPublicKey getPublicKey(long keyID)
throws PGPException
Return the public key refered to by the passed in keyID if it
is present.
keyID
-
- PGPPublicKey
PGPException
-
getPublicKeys
public Iterator getPublicKeys()
Return an iterator containing all the public keys.
- Iterator
insertPublicKey
public static PGPPublicKeyRing insertPublicKey(PGPPublicKeyRing pubRing,
PGPPublicKey pubKey)
Returns a new key ring with the publick key passed in
either added or replacing an existing one.
pubRing
- the public key ring to be modifiedpubKey
- the public key to be added.
- a new keyRing
removePublicKey
public static PGPPublicKeyRing removePublicKey(PGPPublicKeyRing pubRing,
PGPPublicKey pubKey)
Returns a new key ring with the publick key passed in
removed from the key ring.
pubRing
- the public key ring to be modifiedpubKey
- the public key to be added.
- a new keyRing, null if pubKey is not found.