public abstract class AbstractOpenPgpStore extends java.lang.Object implements OpenPgpStore
OpenPgpTrustStore.Trust| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<org.jxmpp.jid.BareJid,OpenPgpContact> |
contacts |
protected OpenPgpKeyStore |
keyStore |
protected OpenPgpMetadataStore |
metadataStore |
protected SecretKeyPassphraseCallback |
secretKeyPassphraseCallback |
protected OpenPgpTrustStore |
trustStore |
protected org.pgpainless.key.protection.SecretKeyRingProtector |
unlocker |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractOpenPgpStore(OpenPgpKeyStore keyStore,
OpenPgpMetadataStore metadataStore,
OpenPgpTrustStore trustStore) |
| Modifier and Type | Method and 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.pgpainless.key.collection.PGPKeyRing |
generateKeyRing(org.jxmpp.jid.BareJid owner)
Generate a new
PGPKeyRing for owner. |
java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.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 |
getKeyRingProtector()
Return the
SecretKeyRingProtector which is used to decrypt password protected secret keys. |
OpenPgpContact |
getOpenPgpContact(org.jxmpp.jid.BareJid jid)
Return an
OpenPgpContact for a contacts jid. |
java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.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. |
OpenPgpTrustStore.Trust |
getTrust(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint 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,
java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.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,
java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.Date> dates)
Set the last date on which keys of
contact were fetched from PubSub. |
void |
setSecretKeyPassphraseCallback(SecretKeyPassphraseCallback callback)
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)
|
protected final OpenPgpKeyStore keyStore
protected final OpenPgpMetadataStore metadataStore
protected final OpenPgpTrustStore trustStore
protected SecretKeyPassphraseCallback secretKeyPassphraseCallback
protected org.pgpainless.key.protection.SecretKeyRingProtector unlocker
protected final java.util.Map<org.jxmpp.jid.BareJid,OpenPgpContact> contacts
protected AbstractOpenPgpStore(OpenPgpKeyStore keyStore, OpenPgpMetadataStore metadataStore, OpenPgpTrustStore trustStore)
public void deletePublicKeyRing(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
throws java.io.IOException,
org.bouncycastle.openpgp.PGPException
OpenPgpKeyStorePGPPublicKeyRing which contains the key described by fingerprint from the
PGPPublicKeyRingCollection of owner.deletePublicKeyRing in interface OpenPgpKeyStoreowner - owner of the key ringfingerprint - fingerprint of the key whose key ring will be removed.java.io.IOException - IO is dangerousorg.bouncycastle.openpgp.PGPException - PGP is brittlepublic void deleteSecretKeyRing(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
throws java.io.IOException,
org.bouncycastle.openpgp.PGPException
OpenPgpKeyStorePGPSecretKeyRing which contains the key described by fingerprint from the
PGPSecretKeyRingCollection of owner.deleteSecretKeyRing in interface OpenPgpKeyStoreowner - owner of the key ringfingerprint - fingerprint of the key whose key ring will be removed.java.io.IOException - IO is dangerousorg.bouncycastle.openpgp.PGPException - PGP is brittlepublic OpenPgpContact getOpenPgpContact(org.jxmpp.jid.BareJid jid)
OpenPgpStoreOpenPgpContact for a contacts jid.getOpenPgpContact in interface OpenPgpStorejid - BareJid of the contact.OpenPgpContact object of the contact.public void setKeyRingProtector(org.pgpainless.key.protection.SecretKeyRingProtector protector)
OpenPgpStoreSecretKeyRingProtector which is used to decrypt password protected secret keys.setKeyRingProtector in interface OpenPgpStoreprotector - unlocker which unlocks encrypted secret keys.public org.pgpainless.key.protection.SecretKeyRingProtector getKeyRingProtector()
OpenPgpStoreSecretKeyRingProtector which is used to decrypt password protected secret keys.
In case no SecretKeyRingProtector has been set, this method MUST return an UnprotectedKeysProtector.getKeyRingProtector in interface OpenPgpStorepublic void setSecretKeyPassphraseCallback(SecretKeyPassphraseCallback callback)
OpenPgpStoreSecretKeyPassphraseCallback which is called in case we stumble over a secret key for which we have
no passphrase.setSecretKeyPassphraseCallback in interface OpenPgpStorecallback - callback. MUST NOT be null.public org.bouncycastle.openpgp.PGPPublicKeyRingCollection getPublicKeysOf(org.jxmpp.jid.BareJid owner)
throws java.io.IOException,
org.bouncycastle.openpgp.PGPException
OpenPgpKeyStorePGPPublicKeyRingCollection containing all public keys of owner that are locally
available.
This method might return null.getPublicKeysOf in interface OpenPgpKeyStoreowner - BareJid of the user we want to get keys from.PGPPublicKeyRingCollection of the user.java.io.IOException - IO is dangerousorg.bouncycastle.openpgp.PGPException - PGP is brittlepublic org.bouncycastle.openpgp.PGPSecretKeyRingCollection getSecretKeysOf(org.jxmpp.jid.BareJid owner)
throws java.io.IOException,
org.bouncycastle.openpgp.PGPException
OpenPgpKeyStorePGPSecretKeyRingCollection containing all secret keys of owner which are locally
available.
This method might return null.getSecretKeysOf in interface OpenPgpKeyStoreowner - BareJid of the user we want to get keys from.PGPSecretKeyRingCollection of the user.java.io.IOException - IO is dangerousorg.bouncycastle.openpgp.PGPException - PGP is brittlepublic org.bouncycastle.openpgp.PGPPublicKeyRing getPublicKeyRing(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
throws java.io.IOException,
org.bouncycastle.openpgp.PGPException
OpenPgpKeyStorePGPPublicKeyRing of owner which contains the key described by fingerprint.
This method might return null.getPublicKeyRing in interface OpenPgpKeyStoreowner - BareJid of the keys ownerfingerprint - OpenPgpV4Fingerprint of a key contained in the key ringPGPPublicKeyRing which contains the key described by fingerprint.java.io.IOException - IO is dangerousorg.bouncycastle.openpgp.PGPException - PGP is brittlepublic org.bouncycastle.openpgp.PGPSecretKeyRing getSecretKeyRing(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
throws java.io.IOException,
org.bouncycastle.openpgp.PGPException
OpenPgpKeyStorePGPSecretKeyRing of owner which contains the key described by fingerprint.
This method might return null.getSecretKeyRing in interface OpenPgpKeyStoreowner - BareJid of the keys ownerfingerprint - OpenPgpV4Fingerprint of a key contained in the key ringPGPSecretKeyRing which contains the key described by fingerprint.java.io.IOException - IO is dangerousorg.bouncycastle.openpgp.PGPException - PGP is brittlepublic org.pgpainless.key.collection.PGPKeyRing generateKeyRing(org.jxmpp.jid.BareJid owner)
throws org.bouncycastle.openpgp.PGPException,
java.security.NoSuchAlgorithmException,
java.security.NoSuchProviderException,
java.security.InvalidAlgorithmParameterException
OpenPgpKeyStorePGPKeyRing for owner.
The key will have a user-id containing the users BareJid (eg. "xmpp:juliet@capulet.lit").
This method MUST NOT return null.generateKeyRing in interface OpenPgpKeyStoreowner - owner of the key ring.org.bouncycastle.openpgp.PGPException - PGP is brittlejava.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.public void importSecretKey(org.jxmpp.jid.BareJid owner,
org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)
throws java.io.IOException,
org.bouncycastle.openpgp.PGPException,
MissingUserIdOnKeyException
OpenPgpKeyStorePGPSecretKeyRing of owner.
In case the key ring is already available locally, the keys are skipped.importSecretKey in interface OpenPgpKeyStoreowner - owner of the keyssecretKeys - secret keysjava.io.IOException - IO is dangerousorg.bouncycastle.openpgp.PGPException - PGP is brittleMissingUserIdOnKeyException - in case the secret keys are lacking a user-id with the owners jid.public void importPublicKey(org.jxmpp.jid.BareJid owner,
org.bouncycastle.openpgp.PGPPublicKeyRing publicKeys)
throws java.io.IOException,
org.bouncycastle.openpgp.PGPException,
MissingUserIdOnKeyException
OpenPgpKeyStorePGPPublicKeyRing of owner.
In case the key ring is already available locally, the keys are skipped.importPublicKey in interface OpenPgpKeyStoreowner - owner of the keyspublicKeys - public keysjava.io.IOException - IO is dangerousorg.bouncycastle.openpgp.PGPException - PGP is brittleMissingUserIdOnKeyException - in case the public keys are lacking a user-id with the owners jid.public java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.Date> getPublicKeyFetchDates(org.jxmpp.jid.BareJid contact)
throws java.io.IOException
OpenPgpKeyStorecontact were fetched from PubSub.
This method MUST NOT return null.getPublicKeyFetchDates in interface OpenPgpKeyStorecontact - contact in which we are interested.java.io.IOException - IO is dangerouspublic void setPublicKeyFetchDates(org.jxmpp.jid.BareJid contact,
java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.Date> dates)
throws java.io.IOException
OpenPgpKeyStorecontact were fetched from PubSub.setPublicKeyFetchDates in interface OpenPgpKeyStorecontact - contact in which we are interested.dates - dates of last key fetching.java.io.IOException - IO is dangerouspublic java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.Date> getAnnouncedFingerprintsOf(org.jxmpp.jid.BareJid contact)
throws java.io.IOException
OpenPgpMetadataStoreMap 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.getAnnouncedFingerprintsOf in interface OpenPgpMetadataStorecontact - contact in which we are interested.java.io.IOException - IO is dangerouspublic void setAnnouncedFingerprintsOf(org.jxmpp.jid.BareJid contact,
java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.Date> data)
throws java.io.IOException
OpenPgpMetadataStoresetAnnouncedFingerprintsOf in interface OpenPgpMetadataStorecontact - contact in which we are interested.data - Map containing the contacts announced fingerprints and dates of last modification.java.io.IOException - IO is dangerouspublic OpenPgpTrustStore.Trust getTrust(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws java.io.IOException
OpenPgpTrustStoreOpenPgpTrustStore.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.getTrust in interface OpenPgpTrustStoreowner - owner of the keyfingerprint - fingerprint of the keyjava.io.IOException - IO is dangerouspublic void setTrust(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint fingerprint,
OpenPgpTrustStore.Trust trust)
throws java.io.IOException
OpenPgpTrustStoresetTrust in interface OpenPgpTrustStoreowner - owner of the keyfingerprint - fingerprint of the keytrust - trust recordjava.io.IOException - IO is dangerous