public class PGPSecretKeyRingCollection extends java.lang.Object implements org.bouncycastle.util.Iterable<PGPSecretKeyRing>
Constructor and Description |
---|
PGPSecretKeyRingCollection(byte[] encoding,
KeyFingerPrintCalculator fingerPrintCalculator) |
PGPSecretKeyRingCollection(java.util.Collection<PGPSecretKeyRing> collection) |
PGPSecretKeyRingCollection(java.io.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(java.io.OutputStream outStream) |
byte[] |
getEncoded() |
java.util.Iterator<PGPSecretKeyRing> |
getKeyRings()
return the secret key rings making up this collection.
|
java.util.Iterator<PGPSecretKeyRing> |
getKeyRings(java.lang.String userID)
Return an iterator of the key rings associated with the passed in userID.
|
java.util.Iterator<PGPSecretKeyRing> |
getKeyRings(java.lang.String userID,
boolean matchPartial)
Return an iterator of the key rings associated with the passed in userID.
|
java.util.Iterator<PGPSecretKeyRing> |
getKeyRings(java.lang.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.
|
java.util.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.
|
public PGPSecretKeyRingCollection(byte[] encoding, KeyFingerPrintCalculator fingerPrintCalculator) throws java.io.IOException, PGPException
java.io.IOException
PGPException
public PGPSecretKeyRingCollection(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 PGPSecretKeyRingpublic PGPSecretKeyRingCollection(java.util.Collection<PGPSecretKeyRing> collection)
public int size()
public java.util.Iterator<PGPSecretKeyRing> getKeyRings()
public java.util.Iterator<PGPSecretKeyRing> getKeyRings(java.lang.String userID)
userID
- the user ID to be matched.public java.util.Iterator<PGPSecretKeyRing> getKeyRings(java.lang.String userID, boolean matchPartial)
userID
- the user ID to be matched.matchPartial
- if true userID need only be a substring of an actual ID string to match.public java.util.Iterator<PGPSecretKeyRing> getKeyRings(java.lang.String userID, boolean matchPartial, boolean ignoreCase)
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.public PGPSecretKey getSecretKey(long keyID)
keyID
- id of the secret keypublic PGPSecretKeyRing getSecretKeyRing(long keyID)
keyID
- id of a secret keypublic boolean contains(long keyID)
keyID
- key ID to look for.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 PGPSecretKeyRingCollection addSecretKeyRing(PGPSecretKeyRingCollection ringCollection, PGPSecretKeyRing secretKeyRing)
ringCollection
- the collection the ring to be added to.secretKeyRing
- the key ring to be added.java.lang.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.java.lang.IllegalArgumentException
- if the keyID for the passed in ring is not present.public java.util.Iterator<PGPSecretKeyRing> iterator()
iterator
in interface java.lang.Iterable<PGPSecretKeyRing>