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
Abstract class implementing a validator for signatures supported by a Signature Validation Token (SVT)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
customCertificateRefCheck
(CertReferenceClaims svtCertRef, List<byte[]> sigCertChain, SignatureSVTValidationResult result) Override this method to handle certificate reference types other than the default types.void
customSignatureSVTValidation
(SignatureSVTData signatureSVTData, String hashAlgorithm, SignatureSVTValidationResult result) Override this method to implement custom signature validationprotected abstract List
<SignatureSVTData> getSignatureSVTData
(T signedDataInput) Extract relevant data from the signature necessary to validate its consistency with a SVT record.The main validation method.
-
Constructor Details
-
SVTValidator
public SVTValidator()
-
-
Method Details
-
getSignatureSVTData
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 validationhashAlgorithm
- The hash algorithm used to hash data in the SVTresult
- 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 SVTsigCertChain
- Certificates obtained from the signature in the order they appear in the signatureresult
- result from SVT validation of signature- Returns:
- true if certificates match
-
validate
The main validation method. Validates all SVT records and store the results.- Parameters:
signedDataInput
- signature input data- Returns:
- validation result from SVT signature validation
-