Class JAdESSignaturePolicyStoreBuilder

java.lang.Object
eu.europa.esig.dss.jades.signature.JAdESExtensionBuilder
eu.europa.esig.dss.jades.signature.JAdESSignaturePolicyStoreBuilder

public class JAdESSignaturePolicyStoreBuilder extends JAdESExtensionBuilder
The builder used to incorporate a SignaturePolicyStore to a JAdESSignature document
  • Constructor Details

    • JAdESSignaturePolicyStoreBuilder

      public JAdESSignaturePolicyStoreBuilder()
      Default constructor
  • Method Details

    • addSignaturePolicyStore

      public DSSDocument addSignaturePolicyStore(DSSDocument document, SignaturePolicyStore signaturePolicyStore, boolean base64UrlInstance)
      Adds signaturePolicyStore to all signatures inside the document matching the given SignaturePolicyStore.
      Parameters:
      document - DSSDocument containing JAdES signatures to extend with a SignaturePolicyStore
      signaturePolicyStore - SignaturePolicyStore to incorporate
      base64UrlInstance - TRUE if the signature policy store shall be incorporated as a base64url-encoded component of the 'etsiU' header, FALSE if it will be incorporated in its clear JSON representation
      Returns:
      DSSDocument containing signatures with signaturePolicyStore
    • addSignaturePolicyStore

      public DSSDocument addSignaturePolicyStore(DSSDocument document, SignaturePolicyStore signaturePolicyStore, boolean base64UrlInstance, String signatureId)
      Adds signaturePolicyStore to a signature inside the document with the given signatureId
      Parameters:
      document - DSSDocument containing JAdES signatures to extend with a SignaturePolicyStore
      signaturePolicyStore - SignaturePolicyStore to incorporate
      base64UrlInstance - TRUE if the signature policy store shall be incorporated as a base64url-encoded component of the 'etsiU' header, FALSE if it will be incorporated in its clear JSON representation
      signatureId - String id of a signature to add SignaturePolicyStore for
      Returns:
      DSSDocument containing signatures with signaturePolicyStore
    • addSignaturePolicyStoreIfDigestMatch

      protected boolean addSignaturePolicyStoreIfDigestMatch(JAdESSignature jadesSignature, SignaturePolicyStore signaturePolicyStore, boolean base64UrlInstance, SignedDocumentValidator documentValidator)
      This method adds SignaturePolicyStore to a jadesSignature if required
      Parameters:
      jadesSignature - JAdESSignature signature to add SignaturePolicyStore
      signaturePolicyStore - SignaturePolicyStore to be added
      base64UrlInstance - defines whether SignaturePolicyStore shall be incorporated as a base64url-encoded 'etsiU' component
      documentValidator - SignedDocumentValidator used to extract the signature
      Returns:
      TRUE if the signaturePolicyStore has been added for the particular signature, FALSE otherwise
    • checkDigest

      protected boolean checkDigest(JAdESSignature jadesSignature, SignaturePolicyStore signaturePolicyStore, SignedDocumentValidator documentValidator)
      This method verifies if the digests computed in the provided SignaturePolicyStore match the digest defined in the incorporated signature policy identifier
      Parameters:
      jadesSignature - JAdESSignature to check signature policy identifier
      signaturePolicyStore - SignaturePolicyStore to be incorporated
      documentValidator - SignedDocumentValidator JWS document validator used to extract the signature
      Returns:
      TRUE if the digest match and SignaturePolicyStore can be embedded, FALSE otherwise