Class SVTValidator<T>

java.lang.Object
se.swedenconnect.sigval.svt.validation.SVTValidator<T>
Type Parameters:
T - The type of signature data used in the implementation of this class

public abstract class SVTValidator<T> extends Object
Abstract class implementing a validator for signatures supported by a Signature Validation Token (SVT)
  • Constructor Details

    • SVTValidator

      public SVTValidator()
  • Method Details

    • getSignatureSVTData

      protected abstract List<SignatureSVTData> getSignatureSVTData(T signedDataInput) throws Exception
      Extract relevant data from the signature necessary to validate its consistency with a SVT record.
      Parameters:
      signedDataInput - signed data input providing information about the signature
      Returns:
      a list of SignatureSVTData object. One for each signature to validate.
      Throws:
      Exception - On errors extracting signature SVT data
    • customSignatureSVTValidation

      public void customSignatureSVTValidation(SignatureSVTData signatureSVTData, String hashAlgorithm, SignatureSVTValidationResult result) throws RuntimeException
      Override this method to implement custom signature validation
      Parameters:
      signatureSVTData - Signatrue SVT data collected during default signature validation
      hashAlgorithm - The hash algorithm used to hash data in the SVT
      result - result from SVT validation of signature
      Throws:
      RuntimeException - On errors during custom signature validation
    • customCertificateRefCheck

      protected boolean customCertificateRefCheck(CertReferenceClaims svtCertRef, List<byte[]> sigCertChain, SignatureSVTValidationResult result)
      Override this method to handle certificate reference types other than the default types. This method is only invoked if the reference type is unknown. The override method must write the resulting certificates to the result object. The default behaviour is to fail validation if a custom reference type is encounteredF
      Parameters:
      svtCertRef - Certificate reference data from the SVT
      sigCertChain - Certificates obtained from the signature in the order they appear in the signature
      result - result from SVT validation of signature
      Returns:
      true if certificates match
    • validate

      public List<SignatureSVTValidationResult> validate(T signedDataInput)
      The main validation method. Validates all SVT records and store the results.
      Parameters:
      signedDataInput - signature input data
      Returns:
      validation result from SVT signature validation