Class FileBasedOpenPgpKeyStore

java.lang.Object
org.jivesoftware.smackx.ox.store.abstr.AbstractOpenPgpKeyStore
org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpKeyStore
All Implemented Interfaces:
OpenPgpKeyStore

public class FileBasedOpenPgpKeyStore extends AbstractOpenPgpKeyStore
This class is an implementation of the OpenPgpKeyStore, which stores keys in a file structure. The keys are stored in the following directory structure:
 
 <basePath>/
     <userjid@server.tld>/
         pubring.pkr      // public keys of the user/contact
         secring.pkr      // secret keys of the user
         fetchDates.list  // date of the last time we fetched the users keys
 
 
  • Constructor Details

    • FileBasedOpenPgpKeyStore

      public FileBasedOpenPgpKeyStore(File basePath)
  • Method Details

    • writePublicKeysOf

      public void writePublicKeysOf(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys) throws IOException
      Description copied from class: AbstractOpenPgpKeyStore
      Write the PGPPublicKeyRingCollection of a user to local storage.
      Specified by:
      writePublicKeysOf in class AbstractOpenPgpKeyStore
      Parameters:
      owner - owner of the keys
      publicKeys - keys
      Throws:
      IOException - IO is dangerous
    • writeSecretKeysOf

      public void writeSecretKeysOf(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys) throws IOException
      Description copied from class: AbstractOpenPgpKeyStore
      Write the PGPSecretKeyRingCollection of a user to local storage.
      Specified by:
      writeSecretKeysOf in class AbstractOpenPgpKeyStore
      Parameters:
      owner - owner of the keys
      secretKeys - secret keys
      Throws:
      IOException - IO is dangerous
    • readPublicKeysOf

      public org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeysOf(org.jxmpp.jid.BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
      Description copied from class: AbstractOpenPgpKeyStore
      Read a PGPPublicKeyRingCollection from local storage. This method returns null, if no keys were found.
      Specified by:
      readPublicKeysOf in class AbstractOpenPgpKeyStore
      Parameters:
      owner - owner of the keys
      Returns:
      public keys
      Throws:
      IOException - IO is dangerous
      org.bouncycastle.openpgp.PGPException - PGP is brittle
    • readSecretKeysOf

      public org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeysOf(org.jxmpp.jid.BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
      Description copied from class: AbstractOpenPgpKeyStore
      Read a PGPSecretKeyRingCollection from local storage. This method returns null, if no keys were found.
      Specified by:
      readSecretKeysOf in class AbstractOpenPgpKeyStore
      Parameters:
      owner - owner of the keys
      Returns:
      secret keys
      Throws:
      IOException - IO is dangerous
      org.bouncycastle.openpgp.PGPException - PGP is brittle
    • readKeyFetchDates

      protected Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> readKeyFetchDates(org.jxmpp.jid.BareJid owner) throws IOException
      Description copied from class: AbstractOpenPgpKeyStore
      Read the key fetch dates for a users keys from local storage.
      Specified by:
      readKeyFetchDates in class AbstractOpenPgpKeyStore
      Parameters:
      owner - owner
      Returns:
      fetch dates for the owners keys
      Throws:
      IOException - IO is dangerous
    • writeKeyFetchDates

      protected void writeKeyFetchDates(org.jxmpp.jid.BareJid owner, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates) throws IOException
      Description copied from class: AbstractOpenPgpKeyStore
      Write the key fetch dates for a users keys to local storage.
      Specified by:
      writeKeyFetchDates in class AbstractOpenPgpKeyStore
      Parameters:
      owner - owner
      dates - fetch dates for the owners keys
      Throws:
      IOException - IO is dangerous