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(File basePath)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date>
readKeyFetchDates(BareJid owner)
Read the key fetch dates for a users keys from local storage.org.bouncycastle.openpgp.PGPPublicKeyRingCollection
readPublicKeysOf(BareJid owner)
Read aPGPPublicKeyRingCollection
from local storage.org.bouncycastle.openpgp.PGPSecretKeyRingCollection
readSecretKeysOf(BareJid owner)
Read aPGPSecretKeyRingCollection
from local storage.protected void
writeKeyFetchDates(BareJid owner, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates)
Write the key fetch dates for a users keys to local storage.void
writePublicKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys)
Write thePGPPublicKeyRingCollection
of a user to local storage.void
writeSecretKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys)
Write thePGPSecretKeyRingCollection
of 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(File basePath)
-
-
Method Detail
-
writePublicKeysOf
public void writePublicKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys) throws IOException
Description copied from class:AbstractOpenPgpKeyStore
Write thePGPPublicKeyRingCollection
of a user to local storage.- Specified by:
writePublicKeysOf
in classAbstractOpenPgpKeyStore
- Parameters:
owner
- owner of the keyspublicKeys
- keys- Throws:
IOException
- IO is dangerous
-
writeSecretKeysOf
public void writeSecretKeysOf(BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys) throws IOException
Description copied from class:AbstractOpenPgpKeyStore
Write thePGPSecretKeyRingCollection
of a user to local storage.- Specified by:
writeSecretKeysOf
in classAbstractOpenPgpKeyStore
- Parameters:
owner
- owner of the keyssecretKeys
- secret keys- Throws:
IOException
- IO is dangerous
-
readPublicKeysOf
public org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeysOf(BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
Description copied from class:AbstractOpenPgpKeyStore
Read aPGPPublicKeyRingCollection
from local storage. This method returns null, if no keys were found.- Specified by:
readPublicKeysOf
in classAbstractOpenPgpKeyStore
- Parameters:
owner
- owner of the keys- Returns:
- public keys
- Throws:
IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittle
-
readSecretKeysOf
public org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeysOf(BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
Description copied from class:AbstractOpenPgpKeyStore
Read aPGPSecretKeyRingCollection
from local storage. This method returns null, if no keys were found.- Specified by:
readSecretKeysOf
in classAbstractOpenPgpKeyStore
- Parameters:
owner
- owner of the keys- Returns:
- secret keys
- Throws:
IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittle
-
readKeyFetchDates
protected Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> readKeyFetchDates(BareJid owner) throws IOException
Description copied from class:AbstractOpenPgpKeyStore
Read the key fetch dates for a users keys from local storage.- Specified by:
readKeyFetchDates
in classAbstractOpenPgpKeyStore
- Parameters:
owner
- owner- Returns:
- fetch dates for the owners keys
- Throws:
IOException
- IO is dangerous
-
writeKeyFetchDates
protected void writeKeyFetchDates(BareJid owner, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates) throws IOException
Description copied from class:AbstractOpenPgpKeyStore
Write the key fetch dates for a users keys to local storage.- Specified by:
writeKeyFetchDates
in classAbstractOpenPgpKeyStore
- Parameters:
owner
- ownerdates
- fetch dates for the owners keys- Throws:
IOException
- IO is dangerous
-
-