Class PainlessOpenPgpProvider
java.lang.Object
org.jivesoftware.smackx.ox.crypto.PainlessOpenPgpProvider
- All Implemented Interfaces:
OpenPgpProvider
-
Constructor Summary
Constructors -
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 aCryptElementfor allrecipientsand ourselves.getStore()Return theOpenPgpStoreinstance of this provider.sign(SignElement element, OpenPgpSelf self) Sign aSignElementusing our signing key.signAndEncrypt(SigncryptElement element, OpenPgpSelf self, Collection<OpenPgpContact> recipients) Sign aSigncryptElementusing our signing key and encrypt it for allrecipientsand ourselves.
-
Constructor Details
-
PainlessOpenPgpProvider
-
-
Method Details
-
getStore
Description copied from interface:OpenPgpProviderReturn theOpenPgpStoreinstance of this provider. This MUST NOT return null.- Specified by:
getStorein 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:OpenPgpProviderSign aSigncryptElementusing our signing key and encrypt it for allrecipientsand ourselves.- Specified by:
signAndEncryptin interfaceOpenPgpProvider- Parameters:
element-SigncryptElementwhich contains a payload which will be transmitted.self- our own OpenPGP identity.recipients- recipients identities.- Returns:
- signed and encrypted
SigncryptElementas aOpenPgpElement, along withOpenPgpMetadataabout 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:OpenPgpProviderSign aSignElementusing our signing key.- Specified by:
signin interfaceOpenPgpProvider- Parameters:
element-SignElementwhich contains a payload.self- our OpenPGP identity.- Returns:
- signed
SignElementasOpenPgpElement, along withOpenPgpMetadataabout 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:OpenPgpProviderEncrypt aCryptElementfor allrecipientsand ourselves.- Specified by:
encryptin interfaceOpenPgpProvider- Parameters:
element-CryptElementwhich contains a payload which will be transmitted.self- our own OpenPGP identity.recipients- recipient identities.- Returns:
- encrypted
CryptElementas anOpenPgpElement, along withOpenPgpMetadataabout 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:OpenPgpProviderDecrypt 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 resultingOpenPgpMessagecontains the originalOpenPgpContentElement, as well as information about the encryption/signing.- Specified by:
decryptAndOrVerifyin 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
-