Class CAdESSignaturePolicyStoreBuilder

java.lang.Object
eu.europa.esig.dss.cades.signature.CAdESSignaturePolicyStoreBuilder

public class CAdESSignaturePolicyStoreBuilder extends Object
Builds a SignaturePolicyStore for a CAdES signature
  • Constructor Details

    • CAdESSignaturePolicyStoreBuilder

      public CAdESSignaturePolicyStoreBuilder()
      Default constructor
  • Method Details

    • addSignaturePolicyStore

      public DSSDocument addSignaturePolicyStore(DSSDocument signatureDocument, SignaturePolicyStore signaturePolicyStore)
      Extends all signatures within the given document, matching the provided policy in SignaturePolicyStore
      Parameters:
      signatureDocument - DSSDocument to extend
      signaturePolicyStore - SignaturePolicyStore to add
      Returns:
      CMSSignedData with a SignaturePolicyStore
    • extendCMSSignedData

      public org.bouncycastle.cms.CMSSignedData extendCMSSignedData(org.bouncycastle.cms.CMSSignedData cmsSignedData, SignaturePolicyStore signaturePolicyStore)
      Creates a new CMSSignedData with a SignaturePolicyStore for matching signatures
      Parameters:
      cmsSignedData - CMSSignedData to extend
      signaturePolicyStore - SignaturePolicyStore to add
      Returns:
      CMSSignedData with a SignaturePolicyStore
    • addSignaturePolicyStore

      public DSSDocument addSignaturePolicyStore(DSSDocument signatureDocument, SignaturePolicyStore signaturePolicyStore, String signatureId)
      Adds a signaturePolicyStore to a signature with the given signatureId, if the signature policy identifier matches the policy provided within SignaturePolicyStore
      Parameters:
      signatureDocument - DSSDocument containing signatures to add signature policy store into
      signaturePolicyStore - SignaturePolicyStore to add
      signatureId - String Id of a signature to add SignaturePolicyStore for
      Returns:
      DSSDocument with signaturePolicyStore
    • extendCMSSignedData

      public org.bouncycastle.cms.CMSSignedData extendCMSSignedData(org.bouncycastle.cms.CMSSignedData cmsSignedData, SignaturePolicyStore signaturePolicyStore, String signatureId)
      Creates a new CMSSignedData with a SignaturePolicyStore for a signature with signatureId
      Parameters:
      cmsSignedData - CMSSignedData to extend
      signaturePolicyStore - SignaturePolicyStore to add
      signatureId - String id of a signature to add signature policy store to
      Returns:
      CMSSignedData with a SignaturePolicyStore
    • addSignaturePolicyStoreIfDigestMatch

      protected org.bouncycastle.cms.SignerInformation addSignaturePolicyStoreIfDigestMatch(CAdESSignature cadesSignature, SignaturePolicyStore signaturePolicyStore)
      This method adds SignaturePolicyStore to a cadesSignature if required
      Parameters:
      cadesSignature - CAdESSignature signature to add SignaturePolicyStore
      signaturePolicyStore - SignaturePolicyStore to be added
      Returns:
      SignerInformation containing SignaturePolicyStore if it has been added, original SignerInformation otherwise
    • checkDigest

      protected boolean checkDigest(CAdESSignature cadesSignature, SignaturePolicyStore signaturePolicyStore)
      This method verifies if the digests computed in the provided SignaturePolicyStore match the digest defined in the incorporated signature policy identifier
      Parameters:
      cadesSignature - CAdESSignature to check signature policy identifier
      signaturePolicyStore - SignaturePolicyStore to be incorporated
      Returns:
      TRUE if the digest match and SignaturePolicyStore can be embedded, FALSE otherwise