public class PGPPublicKeyRingCollection extends java.lang.Object implements org.bouncycastle.util.Iterable<PGPPublicKeyRing>
Constructor and Description |
---|
PGPPublicKeyRingCollection(byte[] encoding,
KeyFingerPrintCalculator fingerPrintCalculator) |
PGPPublicKeyRingCollection(java.util.Collection<PGPPublicKeyRing> collection) |
PGPPublicKeyRingCollection(java.io.InputStream in,
KeyFingerPrintCalculator fingerPrintCalculator)
Build a PGPPublicKeyRingCollection from the passed in input stream.
|
Modifier and Type | Method and Description |
---|---|
static PGPPublicKeyRingCollection |
addPublicKeyRing(PGPPublicKeyRingCollection ringCollection,
PGPPublicKeyRing publicKeyRing)
Return a new collection object containing the contents of the passed in collection and
the passed in public key ring.
|
boolean |
contains(byte[] fingerprint)
Return true if a key matching the passed in fingerprint is present, false otherwise.
|
boolean |
contains(long keyID)
Return true if a key matching the passed in key ID is present, false otherwise.
|
void |
encode(java.io.OutputStream outStream) |
byte[] |
getEncoded() |
java.util.Iterator<PGPPublicKeyRing> |
getKeyRings()
return the public key rings making up this collection.
|
java.util.Iterator<PGPPublicKeyRing> |
getKeyRings(java.lang.String userID)
Return an iterator of the key rings associated with the passed in userID.
|
java.util.Iterator<PGPPublicKeyRing> |
getKeyRings(java.lang.String userID,
boolean matchPartial)
Return an iterator of the key rings associated with the passed in userID.
|
java.util.Iterator<PGPPublicKeyRing> |
getKeyRings(java.lang.String userID,
boolean matchPartial,
boolean ignoreCase)
Return an iterator of the key rings associated with the passed in userID.
|
java.util.Iterator<PGPPublicKey> |
getKeysWithSignaturesBy(long keyID)
Return any keys carrying a signature issued by the key represented by keyID.
|
PGPPublicKey |
getPublicKey(byte[] fingerprint)
Return the PGP public key associated with the given key fingerprint.
|
PGPPublicKey |
getPublicKey(long keyID)
Return the PGP public key associated with the given key id.
|
PGPPublicKeyRing |
getPublicKeyRing(byte[] fingerprint)
Return the PGP public key associated with the given key fingerprint.
|
PGPPublicKeyRing |
getPublicKeyRing(long keyID)
Return the public key ring which contains the key referred to by keyID.
|
java.util.Iterator<PGPPublicKeyRing> |
iterator()
Support method for Iterable where available.
|
static PGPPublicKeyRingCollection |
removePublicKeyRing(PGPPublicKeyRingCollection ringCollection,
PGPPublicKeyRing publicKeyRing)
Return a new collection object containing the contents of this collection with
the passed in public key ring removed.
|
int |
size()
Return the number of rings in this collection.
|
public PGPPublicKeyRingCollection(byte[] encoding, KeyFingerPrintCalculator fingerPrintCalculator) throws java.io.IOException, PGPException
java.io.IOException
PGPException
public PGPPublicKeyRingCollection(java.io.InputStream in, KeyFingerPrintCalculator fingerPrintCalculator) throws java.io.IOException, PGPException
in
- input stream containing datajava.io.IOException
- if a problem parsing the base stream occursPGPException
- if an object is encountered which isn't a PGPPublicKeyRingpublic PGPPublicKeyRingCollection(java.util.Collection<PGPPublicKeyRing> collection) throws java.io.IOException, PGPException
java.io.IOException
PGPException
public int size()
public java.util.Iterator<PGPPublicKeyRing> getKeyRings()
public java.util.Iterator<PGPPublicKeyRing> getKeyRings(java.lang.String userID) throws PGPException
userID
- the user ID to be matched.PGPException
public java.util.Iterator<PGPPublicKeyRing> getKeyRings(java.lang.String userID, boolean matchPartial) throws PGPException
userID
- the user ID to be matched.matchPartial
- if true userID need only be a substring of an actual ID string to match.PGPException
public java.util.Iterator<PGPPublicKeyRing> getKeyRings(java.lang.String userID, boolean matchPartial, boolean ignoreCase) throws PGPException
userID
- the user ID to be matched.matchPartial
- if true userID need only be a substring of an actual ID string to match.ignoreCase
- if true case is ignored in user ID comparisons.PGPException
public PGPPublicKey getPublicKey(long keyID) throws PGPException
keyID
- PGPException
public PGPPublicKeyRing getPublicKeyRing(long keyID) throws PGPException
keyID
- key ID to match againstPGPException
public PGPPublicKey getPublicKey(byte[] fingerprint) throws PGPException
fingerprint
- the public key fingerprint to match against.PGPException
public PGPPublicKeyRing getPublicKeyRing(byte[] fingerprint) throws PGPException
fingerprint
- the public key fingerprint to match against.PGPException
public java.util.Iterator<PGPPublicKey> getKeysWithSignaturesBy(long keyID)
keyID
- the key id to be matched against.public boolean contains(long keyID) throws PGPException
keyID
- key ID to look for.PGPException
public boolean contains(byte[] fingerprint) throws PGPException
fingerprint
- hte key fingerprint to look for.PGPException
public byte[] getEncoded() throws java.io.IOException
java.io.IOException
public void encode(java.io.OutputStream outStream) throws java.io.IOException
java.io.IOException
public static PGPPublicKeyRingCollection addPublicKeyRing(PGPPublicKeyRingCollection ringCollection, PGPPublicKeyRing publicKeyRing)
ringCollection
- the collection the ring to be added to.publicKeyRing
- the key ring to be added.java.lang.IllegalArgumentException
- if the keyID for the passed in ring is already present.public static PGPPublicKeyRingCollection removePublicKeyRing(PGPPublicKeyRingCollection ringCollection, PGPPublicKeyRing publicKeyRing)
ringCollection
- the collection the ring to be removed from.publicKeyRing
- the key ring to be removed.java.lang.IllegalArgumentException
- if the keyID for the passed in ring not present.public java.util.Iterator<PGPPublicKeyRing> iterator()
iterator
in interface java.lang.Iterable<PGPPublicKeyRing>