public class PGPSecretKeyRingCollection extends Object implements org.bouncycastle.util.Iterable<PGPSecretKeyRing>
Constructor and Description |
---|
PGPSecretKeyRingCollection(byte[] encoding,
KeyFingerPrintCalculator fingerPrintCalculator) |
PGPSecretKeyRingCollection(Collection<PGPSecretKeyRing> collection) |
PGPSecretKeyRingCollection(InputStream in,
KeyFingerPrintCalculator fingerPrintCalculator)
Build a PGPSecretKeyRingCollection from the passed in input stream.
|
Modifier and Type | Method and Description |
---|---|
static PGPSecretKeyRingCollection |
addSecretKeyRing(PGPSecretKeyRingCollection ringCollection,
PGPSecretKeyRing secretKeyRing)
Return a new collection object containing the contents of the passed in collection and
the passed in secret key ring.
|
boolean |
contains(long keyID)
Return true if a key matching the passed in key ID is present, false otherwise.
|
void |
encode(OutputStream outStream) |
byte[] |
getEncoded() |
Iterator<PGPSecretKeyRing> |
getKeyRings()
return the secret key rings making up this collection.
|
Iterator<PGPSecretKeyRing> |
getKeyRings(String userID)
Return an iterator of the key rings associated with the passed in userID.
|
Iterator<PGPSecretKeyRing> |
getKeyRings(String userID,
boolean matchPartial)
Return an iterator of the key rings associated with the passed in userID.
|
Iterator<PGPSecretKeyRing> |
getKeyRings(String userID,
boolean matchPartial,
boolean ignoreCase)
Return an iterator of the key rings associated with the passed in userID.
|
PGPSecretKey |
getSecretKey(long keyID)
Return the PGP secret key associated with the given key id.
|
PGPSecretKeyRing |
getSecretKeyRing(long keyID)
Return the secret key ring which contains the key referred to by keyID.
|
Iterator<PGPSecretKeyRing> |
iterator()
Support method for Iterable where available.
|
static PGPSecretKeyRingCollection |
removeSecretKeyRing(PGPSecretKeyRingCollection ringCollection,
PGPSecretKeyRing secretKeyRing)
Return a new collection object containing the contents of this collection with
the passed in secret key ring removed.
|
int |
size()
Return the number of rings in this collection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public PGPSecretKeyRingCollection(byte[] encoding, KeyFingerPrintCalculator fingerPrintCalculator) throws IOException, PGPException
IOException
PGPException
public PGPSecretKeyRingCollection(InputStream in, KeyFingerPrintCalculator fingerPrintCalculator) throws IOException, PGPException
in
- input stream containing dataIOException
- if a problem parsinh the base stream occursPGPException
- if an object is encountered which isn't a PGPSecretKeyRingpublic PGPSecretKeyRingCollection(Collection<PGPSecretKeyRing> collection) throws IOException, PGPException
IOException
PGPException
public int size()
public Iterator<PGPSecretKeyRing> getKeyRings()
public Iterator<PGPSecretKeyRing> getKeyRings(String userID) throws PGPException
userID
- the user ID to be matched.PGPException
public Iterator<PGPSecretKeyRing> getKeyRings(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 Iterator<PGPSecretKeyRing> getKeyRings(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 PGPSecretKey getSecretKey(long keyID) throws PGPException
keyID
- PGPException
public PGPSecretKeyRing getSecretKeyRing(long keyID) throws PGPException
keyID
- PGPException
public boolean contains(long keyID) throws PGPException
keyID
- key ID to look for.PGPException
public byte[] getEncoded() throws IOException
IOException
public void encode(OutputStream outStream) throws IOException
IOException
public static PGPSecretKeyRingCollection addSecretKeyRing(PGPSecretKeyRingCollection ringCollection, PGPSecretKeyRing secretKeyRing)
ringCollection
- the collection the ring to be added to.secretKeyRing
- the key ring to be added.IllegalArgumentException
- if the keyID for the passed in ring is already present.public static PGPSecretKeyRingCollection removeSecretKeyRing(PGPSecretKeyRingCollection ringCollection, PGPSecretKeyRing secretKeyRing)
ringCollection
- the collection the ring to be removed from.secretKeyRing
- the key ring to be removed.IllegalArgumentException
- if the keyID for the passed in ring is not present.public Iterator<PGPSecretKeyRing> iterator()
iterator
in interface Iterable<PGPSecretKeyRing>