public class OpenPGPMessageProcessor
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
OpenPGPMessageProcessor.Configuration |
static interface |
OpenPGPMessageProcessor.PGPExceptionCallback
Callback to handle
PGPExceptions. |
| Constructor and Description |
|---|
OpenPGPMessageProcessor()
Create a new
OpenPGPMessageProcessor using the default OpenPGPImplementation. |
OpenPGPMessageProcessor(OpenPGPImplementation implementation)
Create a new
OpenPGPMessageProcessor using the given OpenPGPImplementation. |
OpenPGPMessageProcessor(OpenPGPImplementation implementation,
OpenPGPPolicy policy) |
public OpenPGPMessageProcessor()
OpenPGPMessageProcessor using the default OpenPGPImplementation.public OpenPGPMessageProcessor(OpenPGPImplementation implementation)
OpenPGPMessageProcessor using the given OpenPGPImplementation.implementation - openpgp implementationpublic OpenPGPMessageProcessor(OpenPGPImplementation implementation, OpenPGPPolicy policy)
public OpenPGPMessageProcessor addVerificationCertificate(OpenPGPCertificate issuerCertificate)
OpenPGPCertificate for signature verification.
If the message contains any signatures, the provided certificate will be considered as a candidate to verify
the signature.issuerCertificate - OpenPGP certificatepublic OpenPGPMessageProcessor verifyNotAfter(java.util.Date date)
public OpenPGPMessageProcessor verifyNotBefore(java.util.Date date)
public OpenPGPMessageProcessor addDecryptionKey(OpenPGPKey key)
OpenPGPKey as potential decryption key.
If the message is encrypted for an OpenPGPKey, this key can be tried to decrypt the message.
Keys added via this method will also be available for message decryption if the message was encrypted
to an anonymous recipient (wildcard key-id / fingerprint).key - OpenPGP keypublic OpenPGPMessageProcessor addDecryptionKey(OpenPGPKey key, char[] passphrase)
OpenPGPKey as potential decryption key, along with a KeyPassphraseProvider dedicated
to this key.
If the message is encrypted for an OpenPGPKey, this key can be tried to decrypt the message.
Keys added via this method will also be available for message decryption if the message was encrypted
to an anonymous recipient (wildcard key-id / fingerprint).key - OpenPGP keypublic OpenPGPMessageProcessor addDecryptionKeyPassphrase(char[] passphrase)
OpenPGPKey which key this passphrase for is known in advance,
it is highly advised to call addDecryptionKey(OpenPGPKey, char[]) instead, due to performance reasons.passphrase - key-passphrasepublic OpenPGPMessageProcessor addPublicKeyDataDecryptorFactoryProvider(PublicKeyDataDecryptorFactoryProvider provider)
PublicKeyDataDecryptorFactoryProvider to add support for custom data decryption schemes.
This method can be used to implement support for message decryption using hardware tokens and smart cards.provider - providerpublic OpenPGPMessageProcessor setMissingOpenPGPKeyPassphraseProvider(KeyPassphraseProvider keyPassphraseProvider)
OpenPGPKeys.
This provider is called, if a key cannot be unlocked using any passphrase provided via
addDecryptionKey(OpenPGPKey, char[]).keyPassphraseProvider - key passphrase providerpublic OpenPGPMessageProcessor setMissingOpenPGPCertificateProvider(OpenPGPKeyMaterialProvider.OpenPGPCertificateProvider certificateProvider)
OpenPGPKeyMaterialProvider.OpenPGPCertificateProvider to allow dynamic requesting certificates
for signature verification.
This provider is called if the requested OpenPGPCertificate has not yet been added explicitly
via addVerificationCertificate(OpenPGPCertificate).
This allows lazily requesting verification certificates at runtime.certificateProvider - provider for OpenPGP certificatespublic OpenPGPMessageProcessor setMissingOpenPGPKeyProvider(OpenPGPKeyMaterialProvider.OpenPGPKeyProvider keyProvider)
OpenPGPKeys, which can be used to decrypt encrypted messages.
This provider is called if an OpenPGPKey required to decrypt the message has not yet been
explicitly added via addDecryptionKey(OpenPGPKey).
This allows lazily requesting decryption keys at runtime.keyProvider - provider for OpenPGP keyspublic OpenPGPMessageProcessor addMessagePassphrase(char[] messagePassphrase)
messagePassphrase - passphrase for message decryptionpublic OpenPGPMessageProcessor setMissingMessagePassphraseCallback(MissingMessagePassphraseCallback callback)
MissingMessagePassphraseCallback which will be invoked if the message is encrypted using a passphrase,
but no working passphrase was provided.callback - callbackpublic OpenPGPMessageProcessor setSessionKey(PGPSessionKey sessionKey)
PGPSessionKey with which an encrypted OpenPGP message can be decrypted without the need for
using a private key or passphrase.
Typically, this method can be used, if the PGPSessionKey of a message is already known (e.g. because
the message has already been decrypted before).
The benefit of this is, that public-key operations can be costly.sessionKey - session keypublic OpenPGPMessageInputStream process(java.io.InputStream messageIn) throws java.io.IOException, PGPException
messageIn - input stream of the OpenPGP messagejava.io.IOExceptionPGPExceptionpublic OpenPGPMessageProcessor setExceptionCallback(OpenPGPMessageProcessor.PGPExceptionCallback callback)