iaik.smime.ess.utils
Class SignerInfoVerificationResult

java.lang.Object
  extended by iaik.smime.ess.utils.SignerInfoVerificationResult

public class SignerInfoVerificationResult
extends java.lang.Object

Result of the signature verification of a CMS SignerInfo.

When using a MLA agent to resolve some S/MIME message into its layers, the signatures of all SignerInfos of any included signed layer are verified. If you decide not to stop the layer resolving process if an invalid signature is detected, you later may query the signed layer for the signature verification results, e.g.:

 MLA mla = ...;
 mla.setStopOnInvalidSignature(false);
 // the message to process:
 MimeMessage msg = ...;
 // resolve the message into its layers:
 ESSLayers layers = mla.resolve(msg);
 // query for signed layers
 ESSLayer[] layers = layers.getAllLayers();
 for (int i = 0; i < layers.length; i++) {
   if (layers[i].getType() == ESSLayer.SIGNED_DATA) {
     SignedESSLayer signedLayer = (SignedESSLayer)layers[i];
     // get the SignerInfo verification results:
     SignerInfoVerificationResult[] results = signedLayer.getSignerInfoVerificationResults();
     ...
   }
 }
 
A SignerInfoVerificationResult may have one of three verification states: If the verification status code is not SIGNATURE_VALID, method getSignatureException may be used to get information about the reason of the verification failure:
 int verificationStatus = signerInfoVerificationResult.getVerificationStatus();
 if (verificationStatus != SignerInfoVerificationResult.SIGNATURE_VALID) {
   CMSSignatureException ex = signerInfoVerificationResult.getSignatureException();
   ...
 }
 

See Also:
MLA, ESSLayer, ESSLayers, SignedESSLayer, SignerInfo, CMSSignatureException

Field Summary
static int SIGNATURE_INVALID
          Signature verification status code "signature invalid" (integer 2).
static int SIGNATURE_NOT_VERIFIED
          Signature verification status code "signature not verified" (integer 0, initial state).
static int SIGNATURE_VALID
          Signature verification status code "signature valid" (integer 1).
 
Constructor Summary
SignerInfoVerificationResult(CertificateIdentifier signerID)
          Creates a SignerInfoVerificationResult for the given signer id with verification status code SIGNATURE_NOT_VERIFIED (0).
SignerInfoVerificationResult(int verificationStatus, CertificateIdentifier signerID)
          Creates a new SignerInfoVerificationResult for the given signer id with the given verification status code.
 
Method Summary
 CMSSignatureException getSignatureException()
          Gets the exception that has caused a signature verification failure
 CertificateIdentifier getSignerID()
          Returns the id of the SignerInfo to which this SignerInfoVerifcationResult belongs to.
 int getVerificationStatus()
          Returns the verification status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIGNATURE_NOT_VERIFIED

public static final int SIGNATURE_NOT_VERIFIED
Signature verification status code "signature not verified" (integer 0, initial state). Indicates that the signature yet has not been verified; or that it has not been possible to verify the signature for some reason (e.g. the signer certificate was not available).

See Also:
Constant Field Values

SIGNATURE_VALID

public static final int SIGNATURE_VALID
Signature verification status code "signature valid" (integer 1). Indicates that the signature has been verified and is valid.

See Also:
Constant Field Values

SIGNATURE_INVALID

public static final int SIGNATURE_INVALID
Signature verification status code "signature invalid" (integer 2). Indicates that the signature has been verified and is invalid.

See Also:
Constant Field Values
Constructor Detail

SignerInfoVerificationResult

public SignerInfoVerificationResult(CertificateIdentifier signerID)
Creates a SignerInfoVerificationResult for the given signer id with verification status code SIGNATURE_NOT_VERIFIED (0).

Parameters:
signerID - the id of the SignerInfo to which this SignerInfoVerificationResult belongs to

SignerInfoVerificationResult

public SignerInfoVerificationResult(int verificationStatus,
                                    CertificateIdentifier signerID)
Creates a new SignerInfoVerificationResult for the given signer id with the given verification status code.

Parameters:
verificationStatus - the verification status code, either
signerID - the id of the SignerInfo to which this SignerInfoVerificationResult belongs to
Method Detail

getVerificationStatus

public int getVerificationStatus()
Returns the verification status.

Returns:
the verification status, either

getSignerID

public CertificateIdentifier getSignerID()
Returns the id of the SignerInfo to which this SignerInfoVerifcationResult belongs to. (verification status code SIGNATURE_INVALID (2)).

Returns:
the id of the SignerInfo to which this SignerInfoVerifcationResult belongs to

getSignatureException

public CMSSignatureException getSignatureException()
Gets the exception that has caused a signature verification failure

Returns:
the exception that has caused a signature verification failure, or null if the signature of this signer is valid verification status code

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK-CMS 6.0, (c) 2002 IAIK, (c) 2003, 2023 SIC