public class SignedMailValidator
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SignedMailValidator.ValidationResult |
Constructor and Description |
---|
SignedMailValidator(javax.mail.internet.MimeMessage message,
java.security.cert.PKIXParameters param)
Validates the signed
MimeMessage message. |
SignedMailValidator(javax.mail.internet.MimeMessage message,
java.security.cert.PKIXParameters param,
java.lang.Class certPathReviewerClass)
Validates the signed
MimeMessage message. |
Modifier and Type | Method and Description |
---|---|
protected void |
checkSignerCert(java.security.cert.X509Certificate cert,
java.util.List errors,
java.util.List notifications) |
static java.security.cert.CertPath |
createCertPath(java.security.cert.X509Certificate signerCert,
java.util.Set trustanchors,
java.util.List certStores) |
static java.lang.Object[] |
createCertPath(java.security.cert.X509Certificate signerCert,
java.util.Set trustanchors,
java.util.List systemCertStores,
java.util.List userCertStores)
Returns an Object array containing a CertPath and a List of Booleans.
|
java.security.cert.CertStore |
getCertsAndCRLs() |
static java.util.Set |
getEmailAddresses(java.security.cert.X509Certificate cert) |
static java.util.Date |
getSignatureTime(org.bouncycastle.cms.SignerInformation signer) |
org.bouncycastle.cms.SignerInformationStore |
getSignerInformationStore() |
SignedMailValidator.ValidationResult |
getValidationResult(org.bouncycastle.cms.SignerInformation signer) |
protected void |
validateSignatures(java.security.cert.PKIXParameters pkixParam) |
public SignedMailValidator(javax.mail.internet.MimeMessage message, java.security.cert.PKIXParameters param) throws SignedMailValidatorException
MimeMessage
message. The
PKIXParameters
from param are used for the certificate path
validation. The actual PKIXParameters used for the certificate path
validation is a copy of param with the followin changes: param
it's also possible to add additional CertStores
with intermediate Certificates and/or CRLs which then are also used for
the validation.message
- the signed MimeMessageparam
- the parameters for the certificate path validationSignedMailValidatorException
- if the message is no signed message or if an exception occurs
reading the messagepublic SignedMailValidator(javax.mail.internet.MimeMessage message, java.security.cert.PKIXParameters param, java.lang.Class certPathReviewerClass) throws SignedMailValidatorException
MimeMessage
message. The
PKIXParameters
from param are used for the certificate path
validation. The actual PKIXParameters used for the certificate path
validation is a copy of param with the followin changes: param
it's also possible to add additional CertStores
with intermediate Certificates and/or CRLs which then are also used for
the validation.message
- the signed MimeMessageparam
- the parameters for the certificate path validationcertPathReviewerClass
- a subclass of PKIXCertPathReviewer
. The SignedMailValidator
uses objects of this type for the cert path vailidation. The class must
have an empty constructor.SignedMailValidatorException
- if the message is no signed message or if an exception occurs
reading the messagejava.lang.IllegalArgumentException
- if the certPathReviewerClass is not a
subclass of PKIXCertPathReviewer
or objects of
certPathReviewerClass can not be instantiatedprotected void validateSignatures(java.security.cert.PKIXParameters pkixParam)
public static java.util.Set getEmailAddresses(java.security.cert.X509Certificate cert) throws java.io.IOException, java.security.cert.CertificateEncodingException
java.io.IOException
java.security.cert.CertificateEncodingException
protected void checkSignerCert(java.security.cert.X509Certificate cert, java.util.List errors, java.util.List notifications)
public static java.util.Date getSignatureTime(org.bouncycastle.cms.SignerInformation signer)
public static java.security.cert.CertPath createCertPath(java.security.cert.X509Certificate signerCert, java.util.Set trustanchors, java.util.List certStores) throws java.security.GeneralSecurityException
signerCert
- the end of the pathtrustanchors
- trust anchors for the pathcertStores
- java.security.GeneralSecurityException
public static java.lang.Object[] createCertPath(java.security.cert.X509Certificate signerCert, java.util.Set trustanchors, java.util.List systemCertStores, java.util.List userCertStores) throws java.security.GeneralSecurityException
true
if the corresponding certificate in the CertPath was taken from the user provided CertStores.signerCert
- the end of the pathtrustanchors
- trust anchors for the pathsystemCertStores
- list of CertStore
provided by the systemuserCertStores
- list of CertStore
provided by the userjava.security.GeneralSecurityException
public java.security.cert.CertStore getCertsAndCRLs()
public org.bouncycastle.cms.SignerInformationStore getSignerInformationStore()
public SignedMailValidator.ValidationResult getValidationResult(org.bouncycastle.cms.SignerInformation signer) throws SignedMailValidatorException
SignedMailValidatorException