Class OpenPgpContact

  • Direct Known Subclasses:
    OpenPgpSelf

    public class OpenPgpContact
    extends java.lang.Object
    The OpenPgpContact is sort of a specialized view on the OpenPgpStore, which gives you access to the information about the user. It also allows contact-specific actions like fetching the contacts keys from PubSub etc.
    • Method Detail

      • getJid

        public BareJid getJid()
        Return the jid of the contact.
        Returns:
        jid TODO javadoc me please
      • getAnyPublicKeys

        public org.bouncycastle.openpgp.PGPPublicKeyRingCollection getAnyPublicKeys()
                                                                             throws java.io.IOException,
                                                                                    org.bouncycastle.openpgp.PGPException
        Return any available public keys of the user. The result might also contain outdated or invalid keys.
        Returns:
        any keys of the contact.
        Throws:
        java.io.IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • getAnnouncedPublicKeys

        public org.bouncycastle.openpgp.PGPPublicKeyRingCollection getAnnouncedPublicKeys()
                                                                                   throws java.io.IOException,
                                                                                          org.bouncycastle.openpgp.PGPException
        Return any announced public keys. This is the set returned by getAnyPublicKeys() with non-announced keys and keys which lack a user-id with the contacts jid removed.
        Returns:
        announced keys of the contact
        Throws:
        java.io.IOException - IO is dangerous
        org.bouncycastle.openpgp.PGPException - PGP is brittle
      • getPublicKeysOfTrustState

        protected org.bouncycastle.openpgp.PGPPublicKeyRingCollection getPublicKeysOfTrustState​(org.bouncycastle.openpgp.PGPPublicKeyRingCollection keys,
                                                                                                OpenPgpTrustStore.Trust trust)
                                                                                         throws java.io.IOException
        Return a PGPPublicKeyRingCollection, which contains all keys from keys, which are marked with the OpenPgpTrustStore.Trust state of trust.
        Parameters:
        keys - PGPPublicKeyRingCollection
        trust - OpenPgpTrustStore.Trust
        Returns:
        all keys from keys with trust state trust.
        Throws:
        java.io.IOException - IO error
      • getTrustedAnnouncedKeys

        public org.bouncycastle.openpgp.PGPPublicKeyRingCollection getTrustedAnnouncedKeys()
                                                                                    throws java.io.IOException,
                                                                                           org.bouncycastle.openpgp.PGPException
        Return a PGPPublicKeyRingCollection which contains all public keys of the contact, which are announced, as well as marked as OpenPgpTrustStore.Trust.trusted.
        Returns:
        announced, trusted keys.
        Throws:
        java.io.IOException - IO error
        org.bouncycastle.openpgp.PGPException - PGP error
      • getTrustedFingerprints

        public java.util.Set<org.pgpainless.key.OpenPgpV4Fingerprint> getTrustedFingerprints()
                                                                                      throws java.io.IOException,
                                                                                             org.bouncycastle.openpgp.PGPException
        Return a Set of OpenPgpV4Fingerprints of all keys of the contact, which have the trust state OpenPgpTrustStore.Trust.trusted.
        Returns:
        trusted fingerprints
        Throws:
        java.io.IOException - IO error
        org.bouncycastle.openpgp.PGPException - PGP error
      • getUntrustedFingerprints

        public java.util.Set<org.pgpainless.key.OpenPgpV4Fingerprint> getUntrustedFingerprints()
                                                                                        throws java.io.IOException,
                                                                                               org.bouncycastle.openpgp.PGPException
        Return a Set of OpenPgpV4Fingerprints of all keys of the contact, which have the trust state OpenPgpTrustStore.Trust.untrusted.
        Returns:
        untrusted fingerprints
        Throws:
        java.io.IOException - IO error
        org.bouncycastle.openpgp.PGPException - PGP error
      • getUndecidedFingerprints

        public java.util.Set<org.pgpainless.key.OpenPgpV4Fingerprint> getUndecidedFingerprints()
                                                                                        throws java.io.IOException,
                                                                                               org.bouncycastle.openpgp.PGPException
        Return a Set of OpenPgpV4Fingerprints of all keys of the contact, which have the trust state OpenPgpTrustStore.Trust.undecided.
        Returns:
        undecided fingerprints
        Throws:
        java.io.IOException - IO error
        org.bouncycastle.openpgp.PGPException - PGP error
      • getFingerprintsOfKeysWithState

        public java.util.Set<org.pgpainless.key.OpenPgpV4Fingerprint> getFingerprintsOfKeysWithState​(org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys,
                                                                                                     OpenPgpTrustStore.Trust trust)
                                                                                              throws java.io.IOException
        Return a Set of OpenPgpV4Fingerprints of all keys in publicKeys, which are marked with the OpenPgpTrustStore.Trust of trust.
        Parameters:
        publicKeys - PGPPublicKeyRingCollection of keys which are iterated.
        trust - OpenPgpTrustStore.Trust state.
        Returns:
        Set of fingerprints
        Throws:
        java.io.IOException - IO error
      • getTrust

        public OpenPgpTrustStore.Trust getTrust​(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                                         throws java.io.IOException
        Determine the OpenPgpTrustStore.Trust state of the key identified by the fingerprint.
        Parameters:
        fingerprint - OpenPgpV4Fingerprint of the key
        Returns:
        trust record
        Throws:
        java.io.IOException - IO error
      • isTrusted

        public boolean isTrusted​(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                          throws java.io.IOException
        Determine, whether the key identified by the fingerprint is marked as OpenPgpTrustStore.Trust.trusted or not.
        Parameters:
        fingerprint - OpenPgpV4Fingerprint of the key
        Returns:
        true, if the key is marked as trusted, false otherwise
        Throws:
        java.io.IOException - IO error
      • trust

        public void trust​(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                   throws java.io.IOException
        Parameters:
        fingerprint - OpenPgpV4Fingerprint of the key to mark as trusted.
        Throws:
        java.io.IOException - IO error
      • distrust

        public void distrust​(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
                      throws java.io.IOException
        Parameters:
        fingerprint - OpenPgpV4Fingerprint of the key to mark as untrusted.
        Throws:
        java.io.IOException - IO error
      • hasUndecidedKeys

        public boolean hasUndecidedKeys()
                                 throws java.io.IOException,
                                        org.bouncycastle.openpgp.PGPException
        Determine, whether there are keys available, for which we did not yet decided whether to trust them or not.
        Returns:
        more than 0 keys with trust state OpenPgpTrustStore.Trust.undecided.
        Throws:
        java.io.IOException - I/O error reading the keys or trust records.
        org.bouncycastle.openpgp.PGPException - PGP error reading the keys.
      • getUnfetchableKeys

        public java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,​java.lang.Throwable> getUnfetchableKeys()
        Return a Map of any unfetchable keys fingerprints and the cause of them not being fetched.
        Returns:
        unfetchable keys