org.bouncycastle.openpgp

Class PGPPublicKeyRing

public class PGPPublicKeyRing extends PGPKeyRing

general class to hold a collection of PGP Public Keys.
Constructor Summary
PGPPublicKeyRing(byte[] encoding)
PGPPublicKeyRing(InputStream in)
Method Summary
voidencode(OutputStream outStream)
byte[]getEncoded()
PGPPublicKeygetPublicKey()
Return the first public key in the ring.
PGPPublicKeygetPublicKey(long keyID)
Return the public key refered to by the passed in keyID if it is present.
IteratorgetPublicKeys()
Return an iterator containing all the public keys.
static PGPPublicKeyRinginsertPublicKey(PGPPublicKeyRing pubRing, PGPPublicKey pubKey)
Returns a new key ring with the public key passed in either added or replacing an existing one.
static PGPPublicKeyRingremovePublicKey(PGPPublicKeyRing pubRing, PGPPublicKey pubKey)
Returns a new key ring with the public key passed in removed from the key ring.

Constructor Detail

PGPPublicKeyRing

public PGPPublicKeyRing(byte[] encoding)

PGPPublicKeyRing

public PGPPublicKeyRing(InputStream in)

Method Detail

encode

public void encode(OutputStream outStream)

getEncoded

public byte[] getEncoded()

getPublicKey

public PGPPublicKey getPublicKey()
Return the first public key in the ring.

Returns: PGPPublicKey

getPublicKey

public PGPPublicKey getPublicKey(long keyID)
Return the public key refered to by the passed in keyID if it is present.

Parameters: keyID

Returns: PGPPublicKey

Throws: PGPException

getPublicKeys

public Iterator getPublicKeys()
Return an iterator containing all the public keys.

Returns: Iterator

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.

Parameters: pubRing the public key ring to be modified pubKey the public key to be inserted.

Returns: a new keyRing

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.

Parameters: pubRing the public key ring to be modified pubKey the public key to be removed.

Returns: a new keyRing, null if pubKey is not found.