public abstract class AbstractOpenPgpKeyStore extends Object implements OpenPgpKeyStore
Modifier and Type | Field and Description |
---|---|
protected Map<org.jxmpp.jid.BareJid,Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date>> |
keyFetchDates |
protected Map<org.jxmpp.jid.BareJid,org.bouncycastle.openpgp.PGPPublicKeyRingCollection> |
publicKeyRingCollections |
protected Map<org.jxmpp.jid.BareJid,org.bouncycastle.openpgp.PGPSecretKeyRingCollection> |
secretKeyRingCollections |
Constructor and Description |
---|
AbstractOpenPgpKeyStore() |
Modifier and Type | Method and Description |
---|---|
void |
deletePublicKeyRing(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
Remove a
PGPPublicKeyRing which contains the key described by fingerprint from the
PGPPublicKeyRingCollection of owner . |
void |
deleteSecretKeyRing(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
Remove a
PGPSecretKeyRing which contains the key described by fingerprint from the
PGPSecretKeyRingCollection of owner . |
org.pgpainless.key.collection.PGPKeyRing |
generateKeyRing(org.jxmpp.jid.BareJid owner)
Generate a new
PGPKeyRing for owner . |
Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> |
getPublicKeyFetchDates(org.jxmpp.jid.BareJid contact)
Return the last date on which keys of
contact were fetched from PubSub. |
org.bouncycastle.openpgp.PGPPublicKeyRing |
getPublicKeyRing(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
Return the
PGPPublicKeyRing of owner which contains the key described by fingerprint . |
org.bouncycastle.openpgp.PGPPublicKeyRingCollection |
getPublicKeysOf(org.jxmpp.jid.BareJid owner)
Return the
PGPPublicKeyRingCollection containing all public keys of owner that are locally
available. |
org.bouncycastle.openpgp.PGPSecretKeyRing |
getSecretKeyRing(org.jxmpp.jid.BareJid owner,
org.pgpainless.key.OpenPgpV4Fingerprint fingerprint)
Return the
PGPSecretKeyRing of owner which contains the key described by fingerprint . |
org.bouncycastle.openpgp.PGPSecretKeyRingCollection |
getSecretKeysOf(org.jxmpp.jid.BareJid owner)
Return the
PGPSecretKeyRingCollection containing all secret keys of owner which are locally
available. |
void |
importPublicKey(org.jxmpp.jid.BareJid owner,
org.bouncycastle.openpgp.PGPPublicKeyRing publicKeys)
Import a
PGPPublicKeyRing of owner . |
void |
importSecretKey(org.jxmpp.jid.BareJid owner,
org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys)
Import a
PGPSecretKeyRing of owner . |
protected abstract Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> |
readKeyFetchDates(org.jxmpp.jid.BareJid owner)
Read the key fetch dates for a users keys from local storage.
|
protected abstract org.bouncycastle.openpgp.PGPPublicKeyRingCollection |
readPublicKeysOf(org.jxmpp.jid.BareJid owner)
Read a
PGPPublicKeyRingCollection from local storage. |
protected abstract org.bouncycastle.openpgp.PGPSecretKeyRingCollection |
readSecretKeysOf(org.jxmpp.jid.BareJid owner)
Read a
PGPSecretKeyRingCollection from local storage. |
void |
setPublicKeyFetchDates(org.jxmpp.jid.BareJid contact,
Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates)
Set the last date on which keys of
contact were fetched from PubSub. |
protected abstract 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.
|
protected abstract void |
writePublicKeysOf(org.jxmpp.jid.BareJid owner,
org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys)
Write the
PGPPublicKeyRingCollection of a user to local storage. |
protected abstract void |
writeSecretKeysOf(org.jxmpp.jid.BareJid owner,
org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys)
Write the
PGPSecretKeyRingCollection of a user to local storage. |
protected Map<org.jxmpp.jid.BareJid,org.bouncycastle.openpgp.PGPPublicKeyRingCollection> publicKeyRingCollections
protected Map<org.jxmpp.jid.BareJid,org.bouncycastle.openpgp.PGPSecretKeyRingCollection> secretKeyRingCollections
protected Map<org.jxmpp.jid.BareJid,Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date>> keyFetchDates
public AbstractOpenPgpKeyStore()
protected abstract org.bouncycastle.openpgp.PGPPublicKeyRingCollection readPublicKeysOf(org.jxmpp.jid.BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
PGPPublicKeyRingCollection
from local storage.
This method returns null, if no keys were found.owner
- owner of the keysIOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittleprotected abstract void writePublicKeysOf(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRingCollection publicKeys) throws IOException
PGPPublicKeyRingCollection
of a user to local storage.owner
- owner of the keyspublicKeys
- keysIOException
- IO is dangerousprotected abstract org.bouncycastle.openpgp.PGPSecretKeyRingCollection readSecretKeysOf(org.jxmpp.jid.BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
PGPSecretKeyRingCollection
from local storage.
This method returns null, if no keys were found.owner
- owner of the keysIOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittleprotected abstract void writeSecretKeysOf(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRingCollection secretKeys) throws IOException
PGPSecretKeyRingCollection
of a user to local storage.owner
- owner of the keyssecretKeys
- secret keysIOException
- IO is dangerousprotected abstract Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> readKeyFetchDates(org.jxmpp.jid.BareJid owner) throws IOException
owner
- ownerIOException
- IO is dangerousprotected abstract void writeKeyFetchDates(org.jxmpp.jid.BareJid owner, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates) throws IOException
owner
- ownerdates
- fetch dates for the owners keysIOException
- IO is dangerouspublic Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> getPublicKeyFetchDates(org.jxmpp.jid.BareJid contact) throws IOException
OpenPgpKeyStore
contact
were fetched from PubSub.
This method MUST NOT return null.getPublicKeyFetchDates
in interface OpenPgpKeyStore
contact
- contact in which we are interested.IOException
- IO is dangerouspublic void setPublicKeyFetchDates(org.jxmpp.jid.BareJid contact, Map<org.pgpainless.key.OpenPgpV4Fingerprint,Date> dates) throws IOException
OpenPgpKeyStore
contact
were fetched from PubSub.setPublicKeyFetchDates
in interface OpenPgpKeyStore
contact
- contact in which we are interested.dates
- dates of last key fetching.IOException
- IO is dangerouspublic org.bouncycastle.openpgp.PGPPublicKeyRingCollection getPublicKeysOf(org.jxmpp.jid.BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
OpenPgpKeyStore
PGPPublicKeyRingCollection
containing all public keys of owner
that are locally
available.
This method might return null.getPublicKeysOf
in interface OpenPgpKeyStore
owner
- BareJid
of the user we want to get keys from.PGPPublicKeyRingCollection
of the user.IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittlepublic org.bouncycastle.openpgp.PGPSecretKeyRingCollection getSecretKeysOf(org.jxmpp.jid.BareJid owner) throws IOException, org.bouncycastle.openpgp.PGPException
OpenPgpKeyStore
PGPSecretKeyRingCollection
containing all secret keys of owner
which are locally
available.
This method might return null.getSecretKeysOf
in interface OpenPgpKeyStore
owner
- BareJid
of the user we want to get keys from.PGPSecretKeyRingCollection
of the user.IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittlepublic void importSecretKey(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPSecretKeyRing secretKeys) throws IOException, org.bouncycastle.openpgp.PGPException, MissingUserIdOnKeyException
OpenPgpKeyStore
PGPSecretKeyRing
of owner
.
In case the key ring is already available locally, the keys are skipped.importSecretKey
in interface OpenPgpKeyStore
owner
- owner of the keyssecretKeys
- secret keysIOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittleMissingUserIdOnKeyException
- in case the secret keys are lacking a user-id with the owners jid.public void importPublicKey(org.jxmpp.jid.BareJid owner, org.bouncycastle.openpgp.PGPPublicKeyRing publicKeys) throws IOException, org.bouncycastle.openpgp.PGPException, MissingUserIdOnKeyException
OpenPgpKeyStore
PGPPublicKeyRing
of owner
.
In case the key ring is already available locally, the keys are skipped.importPublicKey
in interface OpenPgpKeyStore
owner
- owner of the keyspublicKeys
- public keysIOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittleMissingUserIdOnKeyException
- in case the public keys are lacking a user-id with the owners jid.public org.bouncycastle.openpgp.PGPPublicKeyRing getPublicKeyRing(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException, org.bouncycastle.openpgp.PGPException
OpenPgpKeyStore
PGPPublicKeyRing
of owner
which contains the key described by fingerprint
.
This method might return null.getPublicKeyRing
in interface OpenPgpKeyStore
owner
- BareJid
of the keys ownerfingerprint
- OpenPgpV4Fingerprint
of a key contained in the key ringPGPPublicKeyRing
which contains the key described by fingerprint
.IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittlepublic org.bouncycastle.openpgp.PGPSecretKeyRing getSecretKeyRing(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException, org.bouncycastle.openpgp.PGPException
OpenPgpKeyStore
PGPSecretKeyRing
of owner
which contains the key described by fingerprint
.
This method might return null.getSecretKeyRing
in interface OpenPgpKeyStore
owner
- BareJid
of the keys ownerfingerprint
- OpenPgpV4Fingerprint
of a key contained in the key ringPGPSecretKeyRing
which contains the key described by fingerprint
.IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittlepublic void deletePublicKeyRing(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException, org.bouncycastle.openpgp.PGPException
OpenPgpKeyStore
PGPPublicKeyRing
which contains the key described by fingerprint
from the
PGPPublicKeyRingCollection
of owner
.deletePublicKeyRing
in interface OpenPgpKeyStore
owner
- owner of the key ringfingerprint
- fingerprint of the key whose key ring will be removed.IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittlepublic void deleteSecretKeyRing(org.jxmpp.jid.BareJid owner, org.pgpainless.key.OpenPgpV4Fingerprint fingerprint) throws IOException, org.bouncycastle.openpgp.PGPException
OpenPgpKeyStore
PGPSecretKeyRing
which contains the key described by fingerprint
from the
PGPSecretKeyRingCollection
of owner
.deleteSecretKeyRing
in interface OpenPgpKeyStore
owner
- owner of the key ringfingerprint
- fingerprint of the key whose key ring will be removed.IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittlepublic org.pgpainless.key.collection.PGPKeyRing generateKeyRing(org.jxmpp.jid.BareJid owner) throws org.bouncycastle.openpgp.PGPException, NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException
OpenPgpKeyStore
PGPKeyRing
for owner
.
The key will have a user-id containing the users BareJid
(eg. "xmpp:juliet@capulet.lit").
This method MUST NOT return null.generateKeyRing
in interface OpenPgpKeyStore
owner
- owner of the key ring.org.bouncycastle.openpgp.PGPException
- PGP is brittleNoSuchAlgorithmException
- in case there is no Provider
registered for the used
OpenPGP algorithms.NoSuchProviderException
- in case there is no suitable Provider
registered.InvalidAlgorithmParameterException
- in case an invalid algorithms configuration is used.