public class FileBasedOpenPgpKeyStore extends AbstractOpenPgpKeyStore
OpenPgpKeyStore
, 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
keyFetchDates, publicKeyRingCollections, secretKeyRingCollections
Constructor and Description |
---|
FileBasedOpenPgpKeyStore(File basePath) |
Modifier and Type | Method and Description |
---|---|
protected Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> |
readKeyFetchDates(org.jxmpp.jid.BareJid owner)
Read the key fetch dates for a users keys from local storage.
|
org.bouncycastle.openpgp.PGPPublicKeyRingCollection |
readPublicKeysOf(org.jxmpp.jid.BareJid owner)
Read a
PGPPublicKeyRingCollection from local storage. |
org.bouncycastle.openpgp.PGPSecretKeyRingCollection |
readSecretKeysOf(org.jxmpp.jid.BareJid owner)
Read a
PGPSecretKeyRingCollection from local storage. |
protected void |
writeKeyFetchDates(org.jxmpp.jid.BareJid owner,
Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates)
Write the key fetch dates for a users keys to local storage.
|
void |
writePublicKeysOf(org.jxmpp.jid.BareJid owner,
org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys)
Write the
PGPPublicKeyRingCollection of a user to local storage. |
void |
writeSecretKeysOf(org.jxmpp.jid.BareJid owner,
org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys)
Write the
PGPSecretKeyRingCollection of a user to local storage. |
deletePublicKeyRing, deleteSecretKeyRing, generateKeyRing, getPublicKeyFetchDates, getPublicKeyRing, getPublicKeysOf, getSecretKeyRing, getSecretKeysOf, importPublicKey, importSecretKey, setPublicKeyFetchDates
public FileBasedOpenPgpKeyStore(File basePath)
public void writePublicKeysOf(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys) throws IOException
AbstractOpenPgpKeyStore
PGPPublicKeyRingCollection
of a user to local storage.writePublicKeysOf
in class AbstractOpenPgpKeyStore
owner
- owner of the keyspublicKeys
- keysIOException
- IO is dangerouspublic void writeSecretKeysOf(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys) throws IOException
AbstractOpenPgpKeyStore
PGPSecretKeyRingCollection
of a user to local storage.writeSecretKeysOf
in class AbstractOpenPgpKeyStore
owner
- owner of the keyssecretKeys
- secret keysIOException
- IO is dangerouspublic org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeysOf(org.jxmpp.jid.BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
AbstractOpenPgpKeyStore
PGPPublicKeyRingCollection
from local storage.
This method returns null, if no keys were found.readPublicKeysOf
in class AbstractOpenPgpKeyStore
owner
- owner of the keysIOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittlepublic org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeysOf(org.jxmpp.jid.BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
AbstractOpenPgpKeyStore
PGPSecretKeyRingCollection
from local storage.
This method returns null, if no keys were found.readSecretKeysOf
in class AbstractOpenPgpKeyStore
owner
- owner of the keysIOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittleprotected Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> readKeyFetchDates(org.jxmpp.jid.BareJid owner) throws IOException
AbstractOpenPgpKeyStore
readKeyFetchDates
in class AbstractOpenPgpKeyStore
owner
- ownerIOException
- IO is dangerousprotected void writeKeyFetchDates(org.jxmpp.jid.BareJid owner, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates) throws IOException
AbstractOpenPgpKeyStore
writeKeyFetchDates
in class AbstractOpenPgpKeyStore
owner
- ownerdates
- fetch dates for the owners keysIOException
- IO is dangerous