Class PGPSecretKeyRingCollection

    • Method Detail

      • size

        public int size()
        Return the number of rings in this collection.
        Returns:
        size of the collection
      • getKeyRings

        public Iterator<PGPSecretKeyRing> getKeyRings​(String userID)
                                               throws PGPException
        Return an iterator of the key rings associated with the passed in userID.
        Parameters:
        userID - the user ID to be matched.
        Returns:
        an iterator (possibly empty) of key rings which matched.
        Throws:
        PGPException
      • getKeyRings

        public Iterator<PGPSecretKeyRing> getKeyRings​(String userID,
                                                      boolean matchPartial)
                                               throws PGPException
        Return an iterator of the key rings associated with the passed in userID.

        Parameters:
        userID - the user ID to be matched.
        matchPartial - if true userID need only be a substring of an actual ID string to match.
        Returns:
        an iterator (possibly empty) of key rings which matched.
        Throws:
        PGPException
      • getKeyRings

        public Iterator<PGPSecretKeyRing> getKeyRings​(String userID,
                                                      boolean matchPartial,
                                                      boolean ignoreCase)
                                               throws PGPException
        Return an iterator of the key rings associated with the passed in userID.

        Parameters:
        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.
        Returns:
        an iterator (possibly empty) of key rings which matched.
        Throws:
        PGPException
      • getSecretKey

        public PGPSecretKey getSecretKey​(long keyID)
                                  throws PGPException
        Return the PGP secret key associated with the given key id.
        Parameters:
        keyID -
        Returns:
        the secret key
        Throws:
        PGPException
      • getSecretKeyRing

        public PGPSecretKeyRing getSecretKeyRing​(long keyID)
                                          throws PGPException
        Return the secret key ring which contains the key referred to by keyID.
        Parameters:
        keyID -
        Returns:
        the secret key ring
        Throws:
        PGPException
      • contains

        public boolean contains​(long keyID)
                         throws PGPException
        Return true if a key matching the passed in key ID is present, false otherwise.
        Parameters:
        keyID - key ID to look for.
        Returns:
        true if keyID present, false otherwise.
        Throws:
        PGPException
      • addSecretKeyRing

        public 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.
        Parameters:
        ringCollection - the collection the ring to be added to.
        secretKeyRing - the key ring to be added.
        Returns:
        a new collection merging the current one with the passed in ring.
        Throws:
        IllegalArgumentException - if the keyID for the passed in ring is already present.
      • removeSecretKeyRing

        public 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.
        Parameters:
        ringCollection - the collection the ring to be removed from.
        secretKeyRing - the key ring to be removed.
        Returns:
        a new collection merging the current one with the passed in ring.
        Throws:
        IllegalArgumentException - if the keyID for the passed in ring is not present.