Class AbstractOpenPgpKeyStore
java.lang.Object
org.jivesoftware.smackx.ox.store.abstr.AbstractOpenPgpKeyStore
- All Implemented Interfaces:
OpenPgpKeyStore
- Direct Known Subclasses:
FileBasedOpenPgpKeyStore
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeletePublicKeyRing(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) Remove aPGPPublicKeyRingwhich contains the key described byfingerprintfrom thePGPPublicKeyRingCollectionofowner.voiddeleteSecretKeyRing(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) Remove aPGPSecretKeyRingwhich contains the key described byfingerprintfrom thePGPSecretKeyRingCollectionofowner.org.bouncycastle.openpgp.PGPSecretKeyRinggenerateKeyRing(BareJid owner) Generate a newPGPSecretKeyRingforowner.getPublicKeyFetchDates(BareJid contact) Return the last date on which keys ofcontactwere fetched from PubSub.org.bouncycastle.openpgp.PGPPublicKeyRinggetPublicKeyRing(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) Return thePGPPublicKeyRingofownerwhich contains the key described byfingerprint.org.bouncycastle.openpgp.PGPPublicKeyRingCollectiongetPublicKeysOf(BareJid owner) Return thePGPPublicKeyRingCollectioncontaining all public keys ofownerthat are locally available.org.bouncycastle.openpgp.PGPSecretKeyRinggetSecretKeyRing(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) Return thePGPSecretKeyRingofownerwhich contains the key described byfingerprint.org.bouncycastle.openpgp.PGPSecretKeyRingCollectiongetSecretKeysOf(BareJid owner) Return thePGPSecretKeyRingCollectioncontaining all secret keys ofownerwhich are locally available.voidimportPublicKey(BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRing publicKeys) Import aPGPPublicKeyRingofowner.voidimportSecretKey(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys) Import aPGPSecretKeyRingofowner.readKeyFetchDates(BareJid owner) Read the key fetch dates for a users keys from local storage.protected abstract org.bouncycastle.openpgp.PGPPublicKeyRingCollectionreadPublicKeysOf(BareJid owner) Read aPGPPublicKeyRingCollectionfrom local storage.protected abstract org.bouncycastle.openpgp.PGPSecretKeyRingCollectionreadSecretKeysOf(BareJid owner) Read aPGPSecretKeyRingCollectionfrom local storage.voidsetPublicKeyFetchDates(BareJid contact, Map<org.pgpainless.key.OpenPgpV4Fingerprint, Date> dates) Set the last date on which keys ofcontactwere fetched from PubSub.protected abstract voidwriteKeyFetchDates(BareJid owner, Map<org.pgpainless.key.OpenPgpV4Fingerprint, Date> dates) Write the key fetch dates for a users keys to local storage.protected abstract voidwritePublicKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys) Write thePGPPublicKeyRingCollectionof a user to local storage.protected abstract voidwriteSecretKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys) Write thePGPSecretKeyRingCollectionof a user to local storage.
-
Field Details
-
LOGGER
-
publicKeyRingCollections
-
secretKeyRingCollections
-
keyFetchDates
-
-
Constructor Details
-
AbstractOpenPgpKeyStore
public AbstractOpenPgpKeyStore()
-
-
Method Details
-
readPublicKeysOf
protected abstract org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeysOf(BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException Read aPGPPublicKeyRingCollectionfrom local storage. This method returns null, if no keys were found.- Parameters:
owner- owner of the keys- Returns:
- public keys
- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
writePublicKeysOf
protected abstract void writePublicKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys) throws IOException Write thePGPPublicKeyRingCollectionof a user to local storage.- Parameters:
owner- owner of the keyspublicKeys- keys- Throws:
IOException- IO is dangerous
-
readSecretKeysOf
protected abstract org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeysOf(BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException Read aPGPSecretKeyRingCollectionfrom local storage. This method returns null, if no keys were found.- Parameters:
owner- owner of the keys- Returns:
- secret keys
- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
writeSecretKeysOf
protected abstract void writeSecretKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys) throws IOException Write thePGPSecretKeyRingCollectionof a user to local storage.- Parameters:
owner- owner of the keyssecretKeys- secret keys- Throws:
IOException- IO is dangerous
-
readKeyFetchDates
protected abstract Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> readKeyFetchDates(BareJid owner) throws IOException Read the key fetch dates for a users keys from local storage.- Parameters:
owner- owner- Returns:
- fetch dates for the owners keys
- Throws:
IOException- IO is dangerous
-
writeKeyFetchDates
protected abstract void writeKeyFetchDates(BareJid owner, Map<org.pgpainless.key.OpenPgpV4Fingerprint, Date> dates) throws IOExceptionWrite the key fetch dates for a users keys to local storage.- Parameters:
owner- ownerdates- fetch dates for the owners keys- Throws:
IOException- IO is dangerous
-
getPublicKeyFetchDates
public Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> getPublicKeyFetchDates(BareJid contact) throws IOException Description copied from interface:OpenPgpKeyStoreReturn the last date on which keys ofcontactwere fetched from PubSub. This method MUST NOT return null.- Specified by:
getPublicKeyFetchDatesin interfaceOpenPgpKeyStore- Parameters:
contact- contact in which we are interested.- Returns:
- dates of last key fetching.
- Throws:
IOException- IO is dangerous
-
setPublicKeyFetchDates
public void setPublicKeyFetchDates(BareJid contact, Map<org.pgpainless.key.OpenPgpV4Fingerprint, Date> dates) throws IOExceptionDescription copied from interface:OpenPgpKeyStoreSet the last date on which keys ofcontactwere fetched from PubSub.- Specified by:
setPublicKeyFetchDatesin interfaceOpenPgpKeyStore- Parameters:
contact- contact in which we are interested.dates- dates of last key fetching.- Throws:
IOException- IO is dangerous
-
getPublicKeysOf
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection getPublicKeysOf(BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpKeyStoreReturn thePGPPublicKeyRingCollectioncontaining all public keys ofownerthat are locally available. This method might return null.- Specified by:
getPublicKeysOfin interfaceOpenPgpKeyStore- Parameters:
owner-BareJidof the user we want to get keys from.- Returns:
PGPPublicKeyRingCollectionof the user.- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
getSecretKeysOf
public org.bouncycastle.openpgp.PGPSecretKeyRingCollection getSecretKeysOf(BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpKeyStoreReturn thePGPSecretKeyRingCollectioncontaining all secret keys ofownerwhich are locally available. This method might return null.- Specified by:
getSecretKeysOfin interfaceOpenPgpKeyStore- Parameters:
owner-BareJidof the user we want to get keys from.- Returns:
PGPSecretKeyRingCollectionof the user.- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
importSecretKey
public void importSecretKey(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys) throws IOException, org.bouncycastle.openpgp.PGPException, MissingUserIdOnKeyException Description copied from interface:OpenPgpKeyStoreImport aPGPSecretKeyRingofowner. In case the key ring is already available locally, the keys are skipped.- Specified by:
importSecretKeyin interfaceOpenPgpKeyStore- Parameters:
owner- owner of the keyssecretKeys- secret keys- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittleMissingUserIdOnKeyException- 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 IOException, org.bouncycastle.openpgp.PGPException, MissingUserIdOnKeyException Description copied from interface:OpenPgpKeyStoreImport aPGPPublicKeyRingofowner. In case the key ring is already available locally, the keys are skipped.- Specified by:
importPublicKeyin interfaceOpenPgpKeyStore- Parameters:
owner- owner of the keyspublicKeys- public keys- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittleMissingUserIdOnKeyException- in case the public keys are lacking a user-id with the owners jid.
-
getPublicKeyRing
public org.bouncycastle.openpgp.PGPPublicKeyRing getPublicKeyRing(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpKeyStoreReturn thePGPPublicKeyRingofownerwhich contains the key described byfingerprint. This method might return null.- Specified by:
getPublicKeyRingin interfaceOpenPgpKeyStore- Parameters:
owner-BareJidof the keys ownerfingerprint-OpenPgpV4Fingerprintof a key contained in the key ring- Returns:
PGPPublicKeyRingwhich contains the key described byfingerprint.- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
getSecretKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing getSecretKeyRing(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpKeyStoreReturn thePGPSecretKeyRingofownerwhich contains the key described byfingerprint. This method might return null.- Specified by:
getSecretKeyRingin interfaceOpenPgpKeyStore- Parameters:
owner-BareJidof the keys ownerfingerprint-OpenPgpV4Fingerprintof a key contained in the key ring- Returns:
PGPSecretKeyRingwhich contains the key described byfingerprint.- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
deletePublicKeyRing
public void deletePublicKeyRing(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpKeyStoreRemove aPGPPublicKeyRingwhich contains the key described byfingerprintfrom thePGPPublicKeyRingCollectionofowner.- Specified by:
deletePublicKeyRingin interfaceOpenPgpKeyStore- Parameters:
owner- owner of the key ringfingerprint- fingerprint of the key whose key ring will be removed.- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
deleteSecretKeyRing
public void deleteSecretKeyRing(BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpKeyStoreRemove aPGPSecretKeyRingwhich contains the key described byfingerprintfrom thePGPSecretKeyRingCollectionofowner.- Specified by:
deleteSecretKeyRingin interfaceOpenPgpKeyStore- Parameters:
owner- owner of the key ringfingerprint- fingerprint of the key whose key ring will be removed.- Throws:
IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
generateKeyRing
public org.bouncycastle.openpgp.PGPSecretKeyRing generateKeyRing(BareJid owner) throws org.bouncycastle.openpgp.PGPException, NoSuchAlgorithmException, InvalidAlgorithmParameterException Description copied from interface:OpenPgpKeyStoreGenerate a newPGPSecretKeyRingforowner. The key will have a user-id containing the usersBareJid(eg. "xmpp:juliet@capulet.lit"). This method MUST NOT return null.- Specified by:
generateKeyRingin interfaceOpenPgpKeyStore- Parameters:
owner- owner of the key ring.- Returns:
- key ring
- Throws:
org.bouncycastle.openpgp.PGPException- PGP is brittleNoSuchAlgorithmException- in case there is noProviderregistered for the used OpenPGP algorithms.InvalidAlgorithmParameterException- in case an invalid algorithms configuration is used.
-