Class PainlessOpenPgpProvider
java.lang.Object
org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider
- All Implemented Interfaces:
OpenPgpProvider
-
Constructor Summary
-
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.
-
Constructor Details
-
PainlessOpenPgpProvider
-
-
Method Details
-
getStore
Description copied from interface:OpenPgpProvider
Return theOpenPgpStore
instance of this provider. This MUST NOT return null.- Specified by:
getStore
in interfaceOpenPgpProvider
- Returns:
- store TODO javadoc me please
-
signAndEncrypt
public OpenPgpElementAndMetadata signAndEncrypt(SigncryptElement element, OpenPgpSelf self, Collection<OpenPgpContact> recipients) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpProvider
Sign aSigncryptElement
using our signing key and encrypt it for allrecipients
and ourselves.- Specified by:
signAndEncrypt
in interfaceOpenPgpProvider
- 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
public OpenPgpElementAndMetadata sign(SignElement element, OpenPgpSelf self) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpProvider
Sign aSignElement
using our signing key.- Specified by:
sign
in interfaceOpenPgpProvider
- 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
public OpenPgpElementAndMetadata encrypt(CryptElement element, OpenPgpSelf self, Collection<OpenPgpContact> recipients) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpProvider
Encrypt aCryptElement
for allrecipients
and ourselves.- Specified by:
encrypt
in interfaceOpenPgpProvider
- 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
public OpenPgpMessage decryptAndOrVerify(XMPPConnection connection, OpenPgpElement element, OpenPgpSelf self, OpenPgpContact sender) throws IOException, org.bouncycastle.openpgp.PGPException Description copied from interface:OpenPgpProvider
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.- Specified by:
decryptAndOrVerify
in interfaceOpenPgpProvider
- Parameters:
connection
- XMPP connection used to fetch any missing keys.element
- signed and or encryptedOpenPgpElement
.self
- our OpenPGP identity.sender
- OpenPGP identity of the sender.- Returns:
- decrypted message as
OpenPgpMessage
. - Throws:
IOException
- IO is dangerousorg.bouncycastle.openpgp.PGPException
- PGP is brittle
-