Class AbstractOpenPgpKeyStore

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void deletePublicKeyRing​(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
      Remove a PGPPublicKeyRing which contains the key described by fingerprint from the PGPPublicKeyRingCollection of owner.
      void deleteSecretKeyRing​(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
      Remove a PGPSecretKeyRing which contains the key described by fingerprint from the PGPSecretKeyRingCollection of owner.
      org.pgpainless.key.collection.PGPKeyRing generateKeyRing​(BareJid owner)
      Generate a new PGPKeyRing for owner.
      Map<org.pgpainless.key.OpenPgpV4Fingerprint,​Date> getPublicKeyFetchDates​(BareJid contact)
      Return the last date on which keys of contact were fetched from PubSub.
      org.bouncycastle.openpgp.PGPPublicKeyRing getPublicKeyRing​(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
      Return the PGPPublicKeyRing of owner which contains the key described by fingerprint.
      org.bouncycastle.openpgp.PGPPublicKeyRingCollection getPublicKeysOf​(BareJid owner)
      Return the PGPPublicKeyRingCollection containing all public keys of owner that are locally available.
      org.bouncycastle.openpgp.PGPSecretKeyRing getSecretKeyRing​(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
      Return the PGPSecretKeyRing of owner which contains the key described by fingerprint.
      org.bouncycastle.openpgp.PGPSecretKeyRingCollection getSecretKeysOf​(BareJid owner)
      Return the PGPSecretKeyRingCollection containing all secret keys of owner which are locally available.
      void importPublicKey​(BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRing publicKeys)
      Import a PGPPublicKeyRing of owner.
      void importSecretKey​(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)
      Import a PGPSecretKeyRing of owner.
      protected abstract Map<org.pgpainless.key.OpenPgpV4Fingerprint,​Date> readKeyFetchDates​(BareJid owner)
      Read the key fetch dates for a users keys from local storage.
      protected abstract org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeysOf​(BareJid owner)
      Read a PGPPublicKeyRingCollection from local storage.
      protected abstract org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeysOf​(BareJid owner)
      Read a PGPSecretKeyRingCollection from local storage.
      void setPublicKeyFetchDates​(BareJid contact, Map<org.pgpainless.key.OpenPgpV4Fingerprint,​Date> dates)
      Set the last date on which keys of contact were fetched from PubSub.
      protected abstract void writeKeyFetchDates​(BareJid owner, Map<org.pgpainless.key.OpenPgpV4Fingerprint,​Date> dates)
      Write the key fetch dates for a users keys to local storage.
      protected abstract void writePublicKeysOf​(BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys)
      Write the PGPPublicKeyRingCollection of a user to local storage.
      protected abstract void writeSecretKeysOf​(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys)
      Write the PGPSecretKeyRingCollection of a user to local storage.
    • Method Detail

      • readPublicKeysOf

        protected abstract org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeysOf​(BareJid owner)
                                                                                         throws IOException,
                                                                                                org.bouncycastle.openpgp.PGPException
        Read a PGPPublicKeyRingCollection from local storage. This method returns null, if no keys were found.
        Parameters:
        owner - owner of the keys
        Returns:
        public keys
        Throws:
        IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • writePublicKeysOf

        protected abstract void writePublicKeysOf​(BareJid owner,
                                                  org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys)
                                           throws IOException
        Write the PGPPublicKeyRingCollection of a user to local storage.
        Parameters:
        owner - owner of the keys
        publicKeys - keys
        Throws:
        IOException - IO is dangerous
      • readSecretKeysOf

        protected abstract org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeysOf​(BareJid owner)
                                                                                         throws IOException,
                                                                                                org.bouncycastle.openpgp.PGPException
        Read a PGPSecretKeyRingCollection from local storage. This method returns null, if no keys were found.
        Parameters:
        owner - owner of the keys
        Returns:
        secret keys
        Throws:
        IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • writeSecretKeysOf

        protected abstract void writeSecretKeysOf​(BareJid owner,
                                                  org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys)
                                           throws IOException
        Write the PGPSecretKeyRingCollection of a user to local storage.
        Parameters:
        owner - owner of the keys
        secretKeys - secret keys
        Throws:
        IOException - IO is dangerous
      • readKeyFetchDates

        protected abstract Map<org.pgpainless.key.OpenPgpV4Fingerprint,​DatereadKeyFetchDates​(BareJid owner)
                                                                                              throws IOException
        Read the key fetch dates for a users keys from local storage.
        Parameters:
        owner - owner
        Returns:
        fetch dates for the owners keys
        Throws:
        IOException - IO is dangerous
      • writeKeyFetchDates

        protected abstract void writeKeyFetchDates​(BareJid owner,
                                                   Map<org.pgpainless.key.OpenPgpV4Fingerprint,​Date> dates)
                                            throws IOException
        Write the key fetch dates for a users keys to local storage.
        Parameters:
        owner - owner
        dates - fetch dates for the owners keys
        Throws:
        IOException - IO is dangerous
      • getPublicKeysOf

        public org.bouncycastle.openpgp.PGPPublicKeyRingCollection getPublicKeysOf​(BareJid owner)
                                                                            throws IOException,
                                                                                   org.bouncycastle.openpgp.PGPException
        Description copied from interface: OpenPgpKeyStore
        Return the PGPPublicKeyRingCollection containing all public keys of owner that are locally available. This method might return null.
        Specified by:
        getPublicKeysOf in interface OpenPgpKeyStore
        Parameters:
        owner - BareJid of the user we want to get keys from.
        Returns:
        PGPPublicKeyRingCollection of the user.
        Throws:
        IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • getSecretKeysOf

        public org.bouncycastle.openpgp.PGPSecretKeyRingCollection getSecretKeysOf​(BareJid owner)
                                                                            throws IOException,
                                                                                   org.bouncycastle.openpgp.PGPException
        Description copied from interface: OpenPgpKeyStore
        Return the PGPSecretKeyRingCollection containing all secret keys of owner which are locally available. This method might return null.
        Specified by:
        getSecretKeysOf in interface OpenPgpKeyStore
        Parameters:
        owner - BareJid of the user we want to get keys from.
        Returns:
        PGPSecretKeyRingCollection of the user.
        Throws:
        IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • getPublicKeyRing

        public org.bouncycastle.openpgp.PGPPublicKeyRing getPublicKeyRing​(BareJid owner,
                                                                          org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                                                                   throws IOException,
                                                                          org.bouncycastle.openpgp.PGPException
        Description copied from interface: OpenPgpKeyStore
        Return the PGPPublicKeyRing of owner which contains the key described by fingerprint. This method might return null.
        Specified by:
        getPublicKeyRing in interface OpenPgpKeyStore
        Parameters:
        owner - BareJid of the keys owner
        fingerprint - OpenPgpV4Fingerprint of a key contained in the key ring
        Returns:
        PGPPublicKeyRing which contains the key described by fingerprint.
        Throws:
        IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • getSecretKeyRing

        public org.bouncycastle.openpgp.PGPSecretKeyRing getSecretKeyRing​(BareJid owner,
                                                                          org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                                                                   throws IOException,
                                                                          org.bouncycastle.openpgp.PGPException
        Description copied from interface: OpenPgpKeyStore
        Return the PGPSecretKeyRing of owner which contains the key described by fingerprint. This method might return null.
        Specified by:
        getSecretKeyRing in interface OpenPgpKeyStore
        Parameters:
        owner - BareJid of the keys owner
        fingerprint - OpenPgpV4Fingerprint of a key contained in the key ring
        Returns:
        PGPSecretKeyRing which contains the key described by fingerprint.
        Throws:
        IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • deletePublicKeyRing

        public void deletePublicKeyRing​(BareJid owner,
                                        org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                                 throws IOException,
                                        org.bouncycastle.openpgp.PGPException
        Description copied from interface: OpenPgpKeyStore
        Remove a PGPPublicKeyRing which contains the key described by fingerprint from the PGPPublicKeyRingCollection of owner.
        Specified by:
        deletePublicKeyRing in interface OpenPgpKeyStore
        Parameters:
        owner - owner of the key ring
        fingerprint - fingerprint of the key whose key ring will be removed.
        Throws:
        IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • deleteSecretKeyRing

        public void deleteSecretKeyRing​(BareJid owner,
                                        org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                                 throws IOException,
                                        org.bouncycastle.openpgp.PGPException
        Description copied from interface: OpenPgpKeyStore
        Remove a PGPSecretKeyRing which contains the key described by fingerprint from the PGPSecretKeyRingCollection of owner.
        Specified by:
        deleteSecretKeyRing in interface OpenPgpKeyStore
        Parameters:
        owner - owner of the key ring
        fingerprint - fingerprint of the key whose key ring will be removed.
        Throws:
        IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle