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.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, java.util.Map<org.pgpainless.key.OpenPgpV4Fingerprint,java.util.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(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:AbstractOpenPgpKeyStore
Write thePGPPublicKeyRingCollection
of a user to local storage.- Specified by:
writePublicKeysOf
in 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:AbstractOpenPgpKeyStore
Write thePGPSecretKeyRingCollection
of a user to local storage.- Specified by:
writeSecretKeysOf
in 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: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:
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: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:
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: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:
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: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:
java.io.IOException
- IO is dangerous
-
-