Module org.shredzone.acme4j.smime
Package org.shredzone.acme4j.smime.email
Class EmailProcessor.Builder
- java.lang.Object
-
- org.shredzone.acme4j.smime.email.EmailProcessor.Builder
-
- Enclosing class:
- EmailProcessor
public static class EmailProcessor.Builder extends Object
A builder forEmailProcessor
.Use
EmailProcessor.builder()
to generate an instance.- Since:
- 2.16
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EmailProcessor
build(jakarta.mail.Message message)
Builds anEmailProcessor
for the givenMessage
using the current configuration.EmailProcessor.Builder
caCerts()
Uses the standard cacerts truststore for signature verification.EmailProcessor.Builder
certificate(X509Certificate certificate)
Uses the given certificate for signature verification.EmailProcessor.Builder
mailSession(jakarta.mail.Session session)
Uses the given mailSession
for accessing the signed message body.EmailProcessor.Builder
pkixParameters(PKIXParameters param)
Uses the givenPKIXParameters
.EmailProcessor.Builder
relaxed()
Performs relaxed checks.EmailProcessor.Builder
skipVerification()
Skips signature and header verification.EmailProcessor.Builder
strict()
Performs strict checks.EmailProcessor.Builder
trustStore(KeyStore trustStore)
Uses the given truststore for signature verification.
-
-
-
Method Detail
-
skipVerification
public EmailProcessor.Builder skipVerification()
Skips signature and header verification. Use only if the message has already been verified in a previous stage (e.g. by the MTA) or for testing purposes.
-
caCerts
public EmailProcessor.Builder caCerts()
Uses the standard cacerts truststore for signature verification. This is the default.
-
trustStore
public EmailProcessor.Builder trustStore(KeyStore trustStore)
Uses the given truststore for signature verification.This is for self-signed certificates. No revocation checks will take place.
- Parameters:
trustStore
-KeyStore
of the truststore to be used.
-
certificate
public EmailProcessor.Builder certificate(X509Certificate certificate)
Uses the given certificate for signature verification.This is for self-signed certificates. No revocation checks will take place.
- Parameters:
certificate
-X509Certificate
of the CA
-
pkixParameters
public EmailProcessor.Builder pkixParameters(PKIXParameters param)
Uses the givenPKIXParameters
.- Parameters:
param
-PKIXParameters
to be used for signature verification.
-
mailSession
public EmailProcessor.Builder mailSession(jakarta.mail.Session session)
Uses the given mailSession
for accessing the signed message body. A simple default session is used otherwise, which is usually sufficient.- Parameters:
session
-Session
to be used for accessing the message body.
-
strict
public EmailProcessor.Builder strict()
Performs strict checks. Secured headers must exactly match their unsecured counterparts. This is the default.
-
relaxed
public EmailProcessor.Builder relaxed()
Performs relaxed checks. Secured headers might differ in whitespaces or case of the field names. Use this if your MTA has mangled the envelope header.
-
build
public EmailProcessor build(jakarta.mail.Message message) throws AcmeInvalidMessageException
Builds anEmailProcessor
for the givenMessage
using the current configuration.- Parameters:
message
-Message
to create anEmailProcessor
for.- Returns:
- The generated
EmailProcessor
- Throws:
AcmeInvalidMessageException
- if the message fails to be verified. If this exception is thrown, the message MUST be rejected, and MUST NOT be used for certification.
-
-