Class AbstractSignedDocumentProcessor<T,X extends AdesObject>

java.lang.Object
se.idsec.signservice.integration.document.impl.AbstractSignedDocumentProcessor<T,X>
Type Parameters:
T - the type of signature document
X - AdES type
All Implemented Interfaces:
DocumentProcessor<T>, SignedDocumentProcessor<T,X>

public abstract class AbstractSignedDocumentProcessor<T,X extends AdesObject> extends Object implements SignedDocumentProcessor<T,X>
Abstract base class for SignedDocumentProcessor implementations.
Author:
Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
  • Constructor Details

    • AbstractSignedDocumentProcessor

      public AbstractSignedDocumentProcessor()
  • Method Details

    • validateAdesObject

      public final void validateAdesObject(@Nonnull X adesObject, @Nonnull X509Certificate signingCertificate, @Nonnull se.swedenconnect.schemas.csig.dssext_1_1.SignTaskData signTaskData, @Nonnull SignRequestWrapper signRequest, @Nonnull SignResponseWrapper signResponse, se.idsec.signservice.integration.SignResponseProcessingParameters parameters) throws se.idsec.signservice.integration.core.error.SignServiceIntegrationException
      Given a AdES object from the signature the method validates that it is valid.
      Specified by:
      validateAdesObject in interface SignedDocumentProcessor<T,X extends AdesObject>
      Parameters:
      adesObject - the AdES object
      signingCertificate - the signing certificate
      signTaskData - the sign task data
      signRequest - the sign request
      signResponse - the sign response
      parameters - processing parameters received from the caller
      Throws:
      se.idsec.signservice.integration.core.error.SignServiceIntegrationException - for validation errors
    • performAdditionalAdesValidation

      protected void performAdditionalAdesValidation(X adesObject, X509Certificate signingCertificate, se.swedenconnect.schemas.csig.dssext_1_1.SignTaskData signTaskData, SignRequestWrapper signRequest, SignResponseWrapper signResponse, se.idsec.signservice.integration.SignResponseProcessingParameters parameters) throws DocumentProcessingException
      The validateAdesObject(AdesObject, X509Certificate, SignTaskData, SignRequestWrapper, SignResponseWrapper, SignResponseProcessingParameters) method validates that the signer certificate digest of the AdES object is valid. Implementations wishing to check other aspects of the AdES object should implement this method. The default implemention does nothing.

      Validaton errors should use the error code "ades-validation-error", e.g. throw new DocumentProcessingException(new ErrorCode.Code("ades-validation-error"), msg).

      Parameters:
      adesObject - the AdES object
      signingCertificate - the signing certificate
      signTaskData - the sign data
      signRequest - the sign request
      signResponse - the sign response
      parameters - optional processing parameters
      Throws:
      DocumentProcessingException - for validation errors
    • getProcessingConfiguration

      @Nonnull public SignResponseProcessingConfig getProcessingConfiguration()
      Gets the processing configuration that this processor is configured with.
      Specified by:
      getProcessingConfiguration in interface SignedDocumentProcessor<T,X extends AdesObject>
      Returns:
      the processing configuration
    • setProcessingConfiguration

      public void setProcessingConfiguration(SignResponseProcessingConfig processingConfiguration)
      Assigns the processing configuration.
      Parameters:
      processingConfiguration - processing configuration
    • getAlgorithmRegistry

      protected se.swedenconnect.security.algorithms.AlgorithmRegistry getAlgorithmRegistry()
      Gets the algorithm registry. If none has been configured, the AlgorithmRegistrySingleton will be used.
      Returns:
      the algorithm registry to use
    • setAlgorithmRegistry

      public void setAlgorithmRegistry(se.swedenconnect.security.algorithms.AlgorithmRegistry algorithmRegistry)
      Assigns the algorithm registry to use.
      Parameters:
      algorithmRegistry - the algorithm registry to use
    • afterPropertiesSet

      @PostConstruct public void afterPropertiesSet() throws Exception
      Ensures that the processingConfiguration property is assigned. By default SignResponseProcessingConfig.defaultSignResponseProcessingConfig() is used.

      Note: If executing in a Spring Framework environment this method is automatically invoked after all properties have been assigned. Otherwise it should be explicitly invoked.

      Throws:
      Exception - for init errors