public class PGPPublicKeyRing extends PGPKeyRing implements org.bouncycastle.util.Iterable<PGPPublicKey>
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.
Constructor and Description |
---|
PGPPublicKeyRing(byte[] encoding,
KeyFingerPrintCalculator fingerPrintCalculator) |
PGPPublicKeyRing(java.io.InputStream in,
KeyFingerPrintCalculator fingerPrintCalculator) |
Modifier and Type | Method and Description |
---|---|
void |
encode(java.io.OutputStream outStream) |
byte[] |
getEncoded() |
PGPPublicKey |
getPublicKey()
Return the first public key in the ring.
|
PGPPublicKey |
getPublicKey(long keyID)
Return the public key referred to by the passed in keyID if it
is present.
|
java.util.Iterator<PGPPublicKey> |
getPublicKeys()
Return an iterator containing all the public keys.
|
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.
|
java.util.Iterator<PGPPublicKey> |
iterator()
Support method for Iterable where available.
|
static PGPPublicKeyRing |
removePublicKey(PGPPublicKeyRing pubRing,
PGPPublicKey pubKey)
Returns a new key ring with the public key passed in
removed from the key ring.
|
public PGPPublicKeyRing(byte[] encoding, KeyFingerPrintCalculator fingerPrintCalculator) throws java.io.IOException
java.io.IOException
public PGPPublicKeyRing(java.io.InputStream in, KeyFingerPrintCalculator fingerPrintCalculator) throws java.io.IOException
java.io.IOException
public PGPPublicKey getPublicKey()
getPublicKey
in class PGPKeyRing
public PGPPublicKey getPublicKey(long keyID)
getPublicKey
in class PGPKeyRing
keyID
- public java.util.Iterator<PGPPublicKey> getPublicKeys()
getPublicKeys
in class PGPKeyRing
public java.util.Iterator<PGPPublicKey> iterator()
iterator
in interface java.lang.Iterable<PGPPublicKey>
public byte[] getEncoded() throws java.io.IOException
getEncoded
in class PGPKeyRing
java.io.IOException
public void encode(java.io.OutputStream outStream) throws java.io.IOException
encode
in class PGPKeyRing
java.io.IOException
public static PGPPublicKeyRing insertPublicKey(PGPPublicKeyRing pubRing, PGPPublicKey pubKey)
pubRing
- the public key ring to be modifiedpubKey
- the public key to be inserted.public static PGPPublicKeyRing removePublicKey(PGPPublicKeyRing pubRing, PGPPublicKey pubKey)
pubRing
- the public key ring to be modifiedpubKey
- the public key to be removed.