Interface OpenPgpProvider
- All Known Implementing Classes:
PainlessOpenPgpProvider
public interface OpenPgpProvider
-
Method Summary
Modifier and TypeMethodDescriptiondecryptAndOrVerify
(XMPPConnection connection, OpenPgpElement element, OpenPgpSelf self, OpenPgpContact sender) Decrypt and/or verify signatures on an incomingOpenPgpElement
.encrypt
(CryptElement element, OpenPgpSelf self, Collection<OpenPgpContact> recipients) Encrypt aCryptElement
for allrecipients
and ourselves.getStore()
Return theOpenPgpStore
instance of this provider.sign
(SignElement element, OpenPgpSelf self) Sign aSignElement
using our signing key.signAndEncrypt
(SigncryptElement element, OpenPgpSelf self, Collection<OpenPgpContact> recipients) Sign aSigncryptElement
using our signing key and encrypt it for allrecipients
and ourselves.
-
Method Details
-
getStore
Return theOpenPgpStore
instance of this provider. This MUST NOT return null.- Returns:
- store TODO javadoc me please
-
signAndEncrypt
OpenPgpElementAndMetadata signAndEncrypt(SigncryptElement element, OpenPgpSelf self, Collection<OpenPgpContact> recipients) throws IOException, org.bouncycastle.openpgp.PGPException Sign aSigncryptElement
using our signing key and encrypt it for allrecipients
and ourselves.- Parameters:
element
-SigncryptElement
which contains a payload which will be transmitted.self
- our own OpenPGP identity.recipients
- recipients identities.- Returns:
- signed and encrypted
SigncryptElement
as aOpenPgpElement
, along withOpenPgpMetadata
about the encryption/signatures. - Throws:
IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittle
-
sign
OpenPgpElementAndMetadata sign(SignElement element, OpenPgpSelf self) throws IOException, org.bouncycastle.openpgp.PGPException Sign aSignElement
using our signing key.- Parameters:
element
-SignElement
which contains a payload.self
- our OpenPGP identity.- Returns:
- signed
SignElement
asOpenPgpElement
, along withOpenPgpMetadata
about the signatures. - Throws:
IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittle
-
encrypt
OpenPgpElementAndMetadata encrypt(CryptElement element, OpenPgpSelf self, Collection<OpenPgpContact> recipients) throws IOException, org.bouncycastle.openpgp.PGPException Encrypt aCryptElement
for allrecipients
and ourselves.- Parameters:
element
-CryptElement
which contains a payload which will be transmitted.self
- our own OpenPGP identity.recipients
- recipient identities.- Returns:
- encrypted
CryptElement
as anOpenPgpElement
, along withOpenPgpMetadata
about the encryption. - Throws:
IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittle
-
decryptAndOrVerify
OpenPgpMessage decryptAndOrVerify(XMPPConnection connection, OpenPgpElement element, OpenPgpSelf self, OpenPgpContact sender) throws IOException, org.bouncycastle.openpgp.PGPException Decrypt and/or verify signatures on an incomingOpenPgpElement
. If the message is encrypted, this method decrypts it. If it is (also) signed, the signature will be checked. The resultingOpenPgpMessage
contains the originalOpenPgpContentElement
, as well as information about the encryption/signing.- Parameters:
element
- signed and or encryptedOpenPgpElement
.self
- our OpenPGP identity.sender
- OpenPGP identity of the sender.connection
- XMPP connection used to fetch any missing keys.- Returns:
- decrypted message as
OpenPgpMessage
. - Throws:
IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittle
-