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) |
void |
encode(java.io.OutputStream outStream,
boolean forTransfer)
Encode the key ring to outStream, with trust packets stripped out if forTransfer is true.
|
byte[] |
getEncoded() |
byte[] |
getEncoded(boolean forTransfer)
Return an encoding of the key ring, with trust packets stripped out if forTransfer is true.
|
java.util.Iterator<PGPPublicKey> |
getKeysWithSignaturesBy(long keyID)
Return any keys carrying a signature issued by the key represented by keyID.
|
PGPPublicKey |
getPublicKey()
Return the first public key in the ring.
|
PGPPublicKey |
getPublicKey(byte[] fingerprint)
Return the public key with the passed in fingerprint if it
is present.
|
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
- the full keyID of the key of interest.public PGPPublicKey getPublicKey(byte[] fingerprint)
getPublicKey
in class PGPKeyRing
fingerprint
- the full fingerprint of the key of interest.public java.util.Iterator<PGPPublicKey> getKeysWithSignaturesBy(long keyID)
getKeysWithSignaturesBy
in class PGPKeyRing
keyID
- the key id to be matched against.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 byte[] getEncoded(boolean forTransfer) throws java.io.IOException
forTransfer
- if the purpose of encoding is to send key to other users.java.io.IOException
- in case of encoding error.public void encode(java.io.OutputStream outStream) throws java.io.IOException
encode
in class PGPKeyRing
java.io.IOException
public void encode(java.io.OutputStream outStream, boolean forTransfer) throws java.io.IOException
outStream
- stream to write the key encoding to.forTransfer
- if the purpose of encoding is to send key to other users.java.io.IOException
- in case of encoding error.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.