Class AbstractOpenPgpStore

    • Method Detail

      • deletePublicKeyRing

        public void deletePublicKeyRing​(BareJid owner,
                                        org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                                 throws java.io.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:
        java.io.IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • deleteSecretKeyRing

        public void deleteSecretKeyRing​(BareJid owner,
                                        org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                                 throws java.io.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:
        java.io.IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • 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.
      • getPublicKeysOf

        public org.bouncycastle.openpgp.PGPPublicKeyRingCollection getPublicKeysOf​(BareJid owner)
                                                                            throws java.io.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:
        java.io.IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • getSecretKeysOf

        public org.bouncycastle.openpgp.PGPSecretKeyRingCollection getSecretKeysOf​(BareJid owner)
                                                                            throws java.io.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:
        java.io.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 java.io.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:
        java.io.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 java.io.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:
        java.io.IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • generateKeyRing

        public org.pgpainless.key.collection.PGPKeyRing generateKeyRing​(BareJid owner)
                                                                 throws org.bouncycastle.openpgp.PGPException,
                                                                        java.security.NoSuchAlgorithmException,
                                                                        java.security.NoSuchProviderException,
                                                                        java.security.InvalidAlgorithmParameterException
        Description copied from interface: OpenPgpKeyStore
        Generate a new PGPKeyRing 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
        java.security.NoSuchAlgorithmException - in case there is no Provider registered for the used OpenPGP algorithms.
        java.security.NoSuchProviderException - in case there is no suitable Provider registered.
        java.security.InvalidAlgorithmParameterException - in case an invalid algorithms configuration is used.
      • importSecretKey

        public void importSecretKey​(BareJid owner,
                                    org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)
                             throws java.io.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:
        java.io.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​(BareJid owner,
                                    org.bouncycastle.openpgp.PGPPublicKeyRing publicKeys)
                             throws java.io.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:
        java.io.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 java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,​java.util.Date> getPublicKeyFetchDates​(BareJid contact)
                                                                                                           throws java.io.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:
        java.io.IOException - IO is dangerous
      • setPublicKeyFetchDates

        public void setPublicKeyFetchDates​(BareJid contact,
                                           java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,​java.util.Date> dates)
                                    throws java.io.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:
        java.io.IOException - IO is dangerous
      • getAnnouncedFingerprintsOf

        public java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,​java.util.Date> getAnnouncedFingerprintsOf​(BareJid contact)
                                                                                                               throws java.io.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:
        java.io.IOException - IO is dangerous
      • setAnnouncedFingerprintsOf

        public void setAnnouncedFingerprintsOf​(BareJid contact,
                                               java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,​java.util.Date> data)
                                        throws java.io.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:
        java.io.IOException - IO is dangerous