public class OpenPgpContact extends Object
Modifier and Type | Field and Description |
---|---|
protected org.jxmpp.jid.BareJid |
jid |
protected OpenPgpStore |
store |
protected Map<org.pgpainless.key.OpenPgpV4Fingerprint,Throwable> |
unfetchableKeys |
Constructor and Description |
---|
OpenPgpContact(org.jxmpp.jid.BareJid jid,
OpenPgpStore store)
Create a new OpenPgpContact.
|
Modifier and Type | Method and Description |
---|---|
void |
distrust(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
Mark a key as
OpenPgpStore.Trust#untrusted . |
org.bouncycastle.openpgp.PGPPublicKeyRingCollection |
getAnnouncedPublicKeys()
Return any announced public keys.
|
org.bouncycastle.openpgp.PGPPublicKeyRingCollection |
getAnyPublicKeys()
Return any available public keys of the user.
|
Set<org.pgpainless.key.OpenPgpV4Fingerprint> |
getFingerprintsOfKeysWithState(org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys,
OpenPgpTrustStore.Trust trust)
Return a
Set of OpenPgpV4Fingerprint s of all keys in publicKeys , which are marked with the
OpenPgpTrustStore.Trust of trust . |
org.jxmpp.jid.BareJid |
getJid()
Return the jid of the contact.
|
protected org.bouncycastle.openpgp.PGPPublicKeyRingCollection |
getPublicKeysOfTrustState(org.bouncycastle.openpgp.PGPPublicKeyRingCollection keys,
OpenPgpTrustStore.Trust trust)
Return a
PGPPublicKeyRingCollection , which contains all keys from keys , which are marked with the
OpenPgpTrustStore.Trust state of trust . |
OpenPgpTrustStore.Trust |
getTrust(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
Determine the
OpenPgpTrustStore.Trust state of the key identified by the fingerprint . |
org.bouncycastle.openpgp.PGPPublicKeyRingCollection |
getTrustedAnnouncedKeys()
Return a
PGPPublicKeyRingCollection which contains all public keys of the contact, which are announced,
as well as marked as OpenPgpStore.Trust#trusted . |
Set<org.pgpainless.key.OpenPgpV4Fingerprint> |
getTrustedFingerprints()
Return a
Set of OpenPgpV4Fingerprint s of all keys of the contact, which have the trust state
OpenPgpStore.Trust#trusted . |
Set<org.pgpainless.key.OpenPgpV4Fingerprint> |
getUndecidedFingerprints()
Return a
Set of OpenPgpV4Fingerprint s of all keys of the contact, which have the trust state
OpenPgpStore.Trust#undecided . |
Map<org.pgpainless.key.OpenPgpV4Fingerprint,Throwable> |
getUnfetchableKeys()
Return a
Map of any unfetchable keys fingerprints and the cause of them not being fetched. |
Set<org.pgpainless.key.OpenPgpV4Fingerprint> |
getUntrustedFingerprints()
Return a
Set of OpenPgpV4Fingerprint s of all keys of the contact, which have the trust state
OpenPgpStore.Trust#untrusted . |
boolean |
hasUndecidedKeys()
Determine, whether there are keys available, for which we did not yet decided whether to trust them or not.
|
boolean |
isTrusted(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
Determine, whether the key identified by the
fingerprint is marked as
OpenPgpTrustStore.Trust#trusted or not. |
void |
trust(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
Mark a key as
OpenPgpStore.Trust#trusted . |
void |
updateKeys(XMPPConnection connection)
Update the contacts keys by consulting the users PubSub nodes.
|
void |
updateKeys(XMPPConnection connection,
PublicKeysListElement metadata)
Update the contacts keys using a prefetched
PublicKeysListElement . |
protected final org.jxmpp.jid.BareJid jid
protected final OpenPgpStore store
protected final Map<org.pgpainless.key.OpenPgpV4Fingerprint,Throwable> unfetchableKeys
public OpenPgpContact(org.jxmpp.jid.BareJid jid, OpenPgpStore store)
jid
- BareJid
of the contact.store
- OpenPgpStore
.public org.jxmpp.jid.BareJid getJid()
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection getAnyPublicKeys() throws IOException, org.bouncycastle.openpgp.PGPException
IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittlepublic org.bouncycastle.openpgp.PGPPublicKeyRingCollection getAnnouncedPublicKeys() throws IOException, org.bouncycastle.openpgp.PGPException
getAnyPublicKeys()
with non-announced
keys and keys which lack a user-id with the contacts jid removed.IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittleprotected org.bouncycastle.openpgp.PGPPublicKeyRingCollection getPublicKeysOfTrustState(org.bouncycastle.openpgp.PGPPublicKeyRingCollection keys, OpenPgpTrustStore.Trust trust) throws IOException
PGPPublicKeyRingCollection
, which contains all keys from keys
, which are marked with the
OpenPgpTrustStore.Trust
state of trust
.keys
- PGPPublicKeyRingCollection
trust
- OpenPgpTrustStore.Trust
keys
with trust state trust
.IOException
- IO errorpublic org.bouncycastle.openpgp.PGPPublicKeyRingCollection getTrustedAnnouncedKeys() throws IOException, org.bouncycastle.openpgp.PGPException
PGPPublicKeyRingCollection
which contains all public keys of the contact, which are announced,
as well as marked as OpenPgpStore.Trust#trusted
.IOException
- IO errororg.bouncycastle.openpgp.PGPException
- PGP errorpublic Set<org.pgpainless.key.OpenPgpV4Fingerprint> getTrustedFingerprints() throws IOException, org.bouncycastle.openpgp.PGPException
Set
of OpenPgpV4Fingerprint
s of all keys of the contact, which have the trust state
OpenPgpStore.Trust#trusted
.IOException
- IO errororg.bouncycastle.openpgp.PGPException
- PGP errorpublic Set<org.pgpainless.key.OpenPgpV4Fingerprint> getUntrustedFingerprints() throws IOException, org.bouncycastle.openpgp.PGPException
Set
of OpenPgpV4Fingerprint
s of all keys of the contact, which have the trust state
OpenPgpStore.Trust#untrusted
.IOException
- IO errororg.bouncycastle.openpgp.PGPException
- PGP errorpublic Set<org.pgpainless.key.OpenPgpV4Fingerprint> getUndecidedFingerprints() throws IOException, org.bouncycastle.openpgp.PGPException
Set
of OpenPgpV4Fingerprint
s of all keys of the contact, which have the trust state
OpenPgpStore.Trust#undecided
.IOException
- IO errororg.bouncycastle.openpgp.PGPException
- PGP errorpublic Set<org.pgpainless.key.OpenPgpV4Fingerprint> getFingerprintsOfKeysWithState(org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys, OpenPgpTrustStore.Trust trust) throws IOException
Set
of OpenPgpV4Fingerprint
s of all keys in publicKeys
, which are marked with the
OpenPgpTrustStore.Trust
of trust
.publicKeys
- PGPPublicKeyRingCollection
of keys which are iterated.trust
- OpenPgpTrustStore.Trust
state.Set
of fingerprintsIOException
- IO errorpublic OpenPgpTrustStore.Trust getTrust(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException
OpenPgpTrustStore.Trust
state of the key identified by the fingerprint
.fingerprint
- OpenPgpV4Fingerprint
of the keyIOException
- IO errorpublic boolean isTrusted(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException
fingerprint
is marked as
OpenPgpTrustStore.Trust#trusted
or not.fingerprint
- OpenPgpV4Fingerprint
of the keyIOException
- IO errorpublic void trust(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException
OpenPgpStore.Trust#trusted
.fingerprint
- OpenPgpV4Fingerprint
of the key to mark as trusted.IOException
- IO errorpublic void distrust(org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException
OpenPgpStore.Trust#untrusted
.fingerprint
- OpenPgpV4Fingerprint
of the key to mark as untrusted.IOException
- IO errorpublic boolean hasUndecidedKeys() throws IOException, org.bouncycastle.openpgp.PGPException
OpenPgpTrustStore.Trust#undecided
.IOException
- I/O error reading the keys or trust records.org.bouncycastle.openpgp.PGPException
- PGP error reading the keys.public Map<org.pgpainless.key.OpenPgpV4Fingerprint,Throwable> getUnfetchableKeys()
Map
of any unfetchable keys fingerprints and the cause of them not being fetched.public void updateKeys(XMPPConnection connection) throws InterruptedException, SmackException.NotConnectedException, SmackException.NoResponseException, XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, PubSubException.NotAPubSubNodeException, IOException
connection
- our XMPPConnection
.InterruptedException
- In case the thread gets interrupted.SmackException.NotConnectedException
- in case the connection is not connected.SmackException.NoResponseException
- in case the server doesn't respond.XMPPException.XMPPErrorException
- in case of an XMPP protocol error.PubSubException.NotALeafNodeException
- in case the metadata node is not a LeafNode
.PubSubException.NotAPubSubNodeException
- in case the metadata node is not a PubSub node.IOException
- IO is brittle.public void updateKeys(XMPPConnection connection, PublicKeysListElement metadata) throws InterruptedException, SmackException.NotConnectedException, SmackException.NoResponseException, IOException
PublicKeysListElement
.connection
- our XMPPConnection
.metadata
- pre-fetched OX metadata node of the contact.InterruptedException
- in case the thread gets interrupted.SmackException.NotConnectedException
- in case the connection is not connected.SmackException.NoResponseException
- in case the server doesn't respond.IOException
- IO is dangerous.