Class FileBasedOpenPgpKeyStore
- java.lang.Object
-
- org.jivesoftware.smackx.ox.store.abstr.AbstractOpenPgpKeyStore
-
- org.jivesoftware.smackx.ox.store.filebased.FileBasedOpenPgpKeyStore
-
- All Implemented Interfaces:
OpenPgpKeyStore
public class FileBasedOpenPgpKeyStore extends AbstractOpenPgpKeyStore
This class is an implementation of theOpenPgpKeyStore, which stores keys in a file structure. The keys are stored in the following directory structure:<basePath>/ <userjid@server.tld>/ pubring.pkr // public keys of the user/contact secring.pkr // secret keys of the user fetchDates.list // date of the last time we fetched the users keys
-
-
Field Summary
-
Fields inherited from class org.jivesoftware.smackx.ox.store.abstr.AbstractOpenPgpKeyStore
keyFetchDates, LOGGER, publicKeyRingCollections, secretKeyRingCollections
-
-
Constructor Summary
Constructors Constructor Description FileBasedOpenPgpKeyStore(java.io.File basePath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.Date>readKeyFetchDates(BareJid owner)Read the key fetch dates for a users keys from local storage.org.bouncycastle.openpgp.PGPPublicKeyRingCollectionreadPublicKeysOf(BareJid owner)Read aPGPPublicKeyRingCollectionfrom local storage.org.bouncycastle.openpgp.PGPSecretKeyRingCollectionreadSecretKeysOf(BareJid owner)Read aPGPSecretKeyRingCollectionfrom local storage.protected voidwriteKeyFetchDates(BareJid owner, java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.Date> dates)Write the key fetch dates for a users keys to local storage.voidwritePublicKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys)Write thePGPPublicKeyRingCollectionof a user to local storage.voidwriteSecretKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys)Write thePGPSecretKeyRingCollectionof a user to local storage.-
Methods inherited from class org.jivesoftware.smackx.ox.store.abstr.AbstractOpenPgpKeyStore
deletePublicKeyRing, deleteSecretKeyRing, generateKeyRing, getPublicKeyFetchDates, getPublicKeyRing, getPublicKeysOf, getSecretKeyRing, getSecretKeysOf, importPublicKey, importSecretKey, setPublicKeyFetchDates
-
-
-
-
Constructor Detail
-
FileBasedOpenPgpKeyStore
public FileBasedOpenPgpKeyStore(java.io.File basePath)
-
-
Method Detail
-
writePublicKeysOf
public void writePublicKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys) throws java.io.IOException
Description copied from class:AbstractOpenPgpKeyStoreWrite thePGPPublicKeyRingCollectionof a user to local storage.- Specified by:
writePublicKeysOfin classAbstractOpenPgpKeyStore- Parameters:
owner- owner of the keyspublicKeys- keys- Throws:
java.io.IOException- IO is dangerous
-
writeSecretKeysOf
public void writeSecretKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys) throws java.io.IOException
Description copied from class:AbstractOpenPgpKeyStoreWrite thePGPSecretKeyRingCollectionof a user to local storage.- Specified by:
writeSecretKeysOfin classAbstractOpenPgpKeyStore- Parameters:
owner- owner of the keyssecretKeys- secret keys- Throws:
java.io.IOException- IO is dangerous
-
readPublicKeysOf
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeysOf(BareJid owner) throws java.io.IOException, org.bouncycastle.openpgp.PGPException
Description copied from class:AbstractOpenPgpKeyStoreRead aPGPPublicKeyRingCollectionfrom local storage. This method returns null, if no keys were found.- Specified by:
readPublicKeysOfin classAbstractOpenPgpKeyStore- Parameters:
owner- owner of the keys- Returns:
- public keys
- Throws:
java.io.IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
readSecretKeysOf
public org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeysOf(BareJid owner) throws java.io.IOException, org.bouncycastle.openpgp.PGPException
Description copied from class:AbstractOpenPgpKeyStoreRead aPGPSecretKeyRingCollectionfrom local storage. This method returns null, if no keys were found.- Specified by:
readSecretKeysOfin classAbstractOpenPgpKeyStore- Parameters:
owner- owner of the keys- Returns:
- secret keys
- Throws:
java.io.IOException- IO is dangerousorg.bouncycastle.openpgp.PGPException- PGP is brittle
-
readKeyFetchDates
protected java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.Date> readKeyFetchDates(BareJid owner) throws java.io.IOException
Description copied from class:AbstractOpenPgpKeyStoreRead the key fetch dates for a users keys from local storage.- Specified by:
readKeyFetchDatesin classAbstractOpenPgpKeyStore- Parameters:
owner- owner- Returns:
- fetch dates for the owners keys
- Throws:
java.io.IOException- IO is dangerous
-
writeKeyFetchDates
protected void writeKeyFetchDates(BareJid owner, java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.Date> dates) throws java.io.IOException
Description copied from class:AbstractOpenPgpKeyStoreWrite the key fetch dates for a users keys to local storage.- Specified by:
writeKeyFetchDatesin classAbstractOpenPgpKeyStore- Parameters:
owner- ownerdates- fetch dates for the owners keys- Throws:
java.io.IOException- IO is dangerous
-
-