Class AbstractOpenPgpStore

java.lang.Object
org.jivesoftware.smackx.ox.store.abstr.AbstractOpenPgpStore
All Implemented Interfaces:
OpenPgpKeyStore, OpenPgpMetadataStore, OpenPgpStore, OpenPgpTrustStore
Direct Known Subclasses:
FileBasedOpenPgpStore

public abstract class AbstractOpenPgpStore extends Object implements OpenPgpStore
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.jivesoftware.smackx.ox.store.definition.OpenPgpTrustStore

    OpenPgpTrustStore.Trust
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Map<org.jxmpp.jid.BareJid,OpenPgpContact>
     
    protected final OpenPgpKeyStore
     
    protected final OpenPgpMetadataStore
     
     
    protected final OpenPgpTrustStore
     
    protected org.pgpainless.key.protection.SecretKeyRingProtector
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    deletePublicKeyRing(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
    Remove a PGPPublicKeyRing which contains the key described by fingerprint from the PGPPublicKeyRingCollection of owner.
    void
    deleteSecretKeyRing(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
    Remove a PGPSecretKeyRing which contains the key described by fingerprint from the PGPSecretKeyRingCollection of owner.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    generateKeyRing(org.jxmpp.jid.BareJid owner)
    Generate a new PGPSecretKeyRing for owner.
    Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date>
    getAnnouncedFingerprintsOf(org.jxmpp.jid.BareJid contact)
    Return a Map containing all announced fingerprints of a contact, as well as the dates on which they were last modified by contact.
    org.pgpainless.key.protection.SecretKeyRingProtector
    Return the SecretKeyRingProtector which is used to decrypt password protected secret keys.
    getOpenPgpContact(org.jxmpp.jid.BareJid jid)
    Return an OpenPgpContact for a contacts jid.
    Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date>
    getPublicKeyFetchDates(org.jxmpp.jid.BareJid contact)
    Return the last date on which keys of contact were fetched from PubSub.
    org.bouncycastle.openpgp.PGPPublicKeyRing
    getPublicKeyRing(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
    Return the PGPPublicKeyRing of owner which contains the key described by fingerprint.
    org.bouncycastle.openpgp.PGPPublicKeyRingCollection
    getPublicKeysOf(org.jxmpp.jid.BareJid owner)
    Return the PGPPublicKeyRingCollection containing all public keys of owner that are locally available.
    org.bouncycastle.openpgp.PGPSecretKeyRing
    getSecretKeyRing(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
    Return the PGPSecretKeyRing of owner which contains the key described by fingerprint.
    org.bouncycastle.openpgp.PGPSecretKeyRingCollection
    getSecretKeysOf(org.jxmpp.jid.BareJid owner)
    Return the PGPSecretKeyRingCollection containing all secret keys of owner which are locally available.
    getTrust(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
    Return the OpenPgpTrustStore.Trust state of owners key with fingerprint fingerprint.
    void
    importPublicKey(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRing publicKeys)
    Import a PGPPublicKeyRing of owner.
    void
    importSecretKey(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)
    Import a PGPSecretKeyRing of owner.
    void
    setAnnouncedFingerprintsOf(org.jxmpp.jid.BareJid contact, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> data)
    Store a contacts announced fingerprints and dates of last modification.
    void
    setKeyRingProtector(org.pgpainless.key.protection.SecretKeyRingProtector protector)
    Set a SecretKeyRingProtector which is used to decrypt password protected secret keys.
    void
    setPublicKeyFetchDates(org.jxmpp.jid.BareJid contact, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates)
    Set the last date on which keys of contact were fetched from PubSub.
    void
    Set a SecretKeyPassphraseCallback which is called in case we stumble over a secret key for which we have no passphrase.
    void
    setTrust(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint, OpenPgpTrustStore.Trust trust)
    Store the OpenPgpTrustStore.Trust state of owners key with fingerprint fingerprint.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • deletePublicKeyRing

      public void deletePublicKeyRing(org.jxmpp.jid.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(org.jxmpp.jid.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
    • getOpenPgpContact

      public OpenPgpContact getOpenPgpContact(org.jxmpp.jid.BareJid jid)
      Description copied from interface: OpenPgpStore
      Return an OpenPgpContact for a contacts jid.
      Specified by:
      getOpenPgpContact in interface OpenPgpStore
      Parameters:
      jid - BareJid of the contact.
      Returns:
      OpenPgpContact object of the contact.
    • setKeyRingProtector

      public void setKeyRingProtector(org.pgpainless.key.protection.SecretKeyRingProtector protector)
      Description copied from interface: OpenPgpStore
      Set a SecretKeyRingProtector which is used to decrypt password protected secret keys.
      Specified by:
      setKeyRingProtector in interface OpenPgpStore
      Parameters:
      protector - unlocker which unlocks encrypted secret keys.
    • getKeyRingProtector

      public org.pgpainless.key.protection.SecretKeyRingProtector getKeyRingProtector()
      Description copied from interface: OpenPgpStore
      Return the SecretKeyRingProtector which is used to decrypt password protected secret keys. In case no SecretKeyRingProtector has been set, this method MUST return an UnprotectedKeysProtector.
      Specified by:
      getKeyRingProtector in interface OpenPgpStore
      Returns:
      secret key unlocker.
    • setSecretKeyPassphraseCallback

      public void setSecretKeyPassphraseCallback(SecretKeyPassphraseCallback callback)
      Description copied from interface: OpenPgpStore
      Set a SecretKeyPassphraseCallback which is called in case we stumble over a secret key for which we have no passphrase.
      Specified by:
      setSecretKeyPassphraseCallback in interface OpenPgpStore
      Parameters:
      callback - callback. MUST NOT be null.
    • getPublicKeysOf

      public org.bouncycastle.openpgp.PGPPublicKeyRingCollection getPublicKeysOf(org.jxmpp.jid.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(org.jxmpp.jid.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(org.jxmpp.jid.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(org.jxmpp.jid.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
    • generateKeyRing

      public org.bouncycastle.openpgp.PGPSecretKeyRing generateKeyRing(org.jxmpp.jid.BareJid owner) throws org.bouncycastle.openpgp.PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException
      Description copied from interface: OpenPgpKeyStore
      Generate a new PGPSecretKeyRing for owner. The key will have a user-id containing the users BareJid (eg. "xmpp:juliet@capulet.lit"). This method MUST NOT return null.
      Specified by:
      generateKeyRing in interface OpenPgpKeyStore
      Parameters:
      owner - owner of the key ring.
      Returns:
      key ring
      Throws:
      org.bouncycastle.openpgp.PGPException - PGP is brittle
      NoSuchAlgorithmException - in case there is no Provider registered for the used OpenPGP algorithms.
      NoSuchProviderException - in case there is no suitable Provider registered.
      InvalidAlgorithmParameterException - in case an invalid algorithms configuration is used.
    • importSecretKey

      public void importSecretKey(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys) throws IOException, org.bouncycastle.openpgp.PGPException, MissingUserIdOnKeyException
      Description copied from interface: OpenPgpKeyStore
      Import a PGPSecretKeyRing of owner. In case the key ring is already available locally, the keys are skipped.
      Specified by:
      importSecretKey in interface OpenPgpKeyStore
      Parameters:
      owner - owner of the keys
      secretKeys - secret keys
      Throws:
      IOException - IO is dangerous
      org.bouncycastle.openpgp.PGPException - PGP is brittle
      MissingUserIdOnKeyException - in case the secret keys are lacking a user-id with the owners jid.
    • importPublicKey

      public void importPublicKey(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRing publicKeys) throws IOException, org.bouncycastle.openpgp.PGPException, MissingUserIdOnKeyException
      Description copied from interface: OpenPgpKeyStore
      Import a PGPPublicKeyRing of owner. In case the key ring is already available locally, the keys are skipped.
      Specified by:
      importPublicKey in interface OpenPgpKeyStore
      Parameters:
      owner - owner of the keys
      publicKeys - public keys
      Throws:
      IOException - IO is dangerous
      org.bouncycastle.openpgp.PGPException - PGP is brittle
      MissingUserIdOnKeyException - in case the public keys are lacking a user-id with the owners jid.
    • getPublicKeyFetchDates

      public Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> getPublicKeyFetchDates(org.jxmpp.jid.BareJid contact) throws IOException
      Description copied from interface: OpenPgpKeyStore
      Return the last date on which keys of contact were fetched from PubSub. This method MUST NOT return null.
      Specified by:
      getPublicKeyFetchDates in interface OpenPgpKeyStore
      Parameters:
      contact - contact in which we are interested.
      Returns:
      dates of last key fetching.
      Throws:
      IOException - IO is dangerous
    • setPublicKeyFetchDates

      public void setPublicKeyFetchDates(org.jxmpp.jid.BareJid contact, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates) throws IOException
      Description copied from interface: OpenPgpKeyStore
      Set the last date on which keys of contact were fetched from PubSub.
      Specified by:
      setPublicKeyFetchDates in interface OpenPgpKeyStore
      Parameters:
      contact - contact in which we are interested.
      dates - dates of last key fetching.
      Throws:
      IOException - IO is dangerous
    • getAnnouncedFingerprintsOf

      public Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> getAnnouncedFingerprintsOf(org.jxmpp.jid.BareJid contact) throws IOException
      Description copied from interface: OpenPgpMetadataStore
      Return a Map containing all announced fingerprints of a contact, as well as the dates on which they were last modified by contact. This method MUST NOT return null.
      Specified by:
      getAnnouncedFingerprintsOf in interface OpenPgpMetadataStore
      Parameters:
      contact - contact in which we are interested.
      Returns:
      announced fingerprints
      Throws:
      IOException - IO is dangerous
    • setAnnouncedFingerprintsOf

      public void setAnnouncedFingerprintsOf(org.jxmpp.jid.BareJid contact, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> data) throws IOException
      Description copied from interface: OpenPgpMetadataStore
      Store a contacts announced fingerprints and dates of last modification.
      Specified by:
      setAnnouncedFingerprintsOf in interface OpenPgpMetadataStore
      Parameters:
      contact - contact in which we are interested.
      data - Map containing the contacts announced fingerprints and dates of last modification.
      Throws:
      IOException - IO is dangerous
    • getTrust

      public OpenPgpTrustStore.Trust getTrust(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException
      Description copied from interface: OpenPgpTrustStore
      Return the OpenPgpTrustStore.Trust state of owners key with fingerprint fingerprint. The trust state describes, whether the user trusts a certain key of a contact. If no OpenPgpTrustStore.Trust record has been found, this method MUST return not null, nut OpenPgpTrustStore.Trust.undecided.
      Specified by:
      getTrust in interface OpenPgpTrustStore
      Parameters:
      owner - owner of the key
      fingerprint - fingerprint of the key
      Returns:
      trust state
      Throws:
      IOException - IO is dangerous
    • setTrust

      public void setTrust(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint, OpenPgpTrustStore.Trust trust) throws IOException
      Description copied from interface: OpenPgpTrustStore
      Store the OpenPgpTrustStore.Trust state of owners key with fingerprint fingerprint.
      Specified by:
      setTrust in interface OpenPgpTrustStore
      Parameters:
      owner - owner of the key
      fingerprint - fingerprint of the key
      trust - trust record
      Throws:
      IOException - IO is dangerous