Class CAdESSignature
java.lang.Object
eu.europa.esig.dss.validation.DefaultAdvancedSignature
eu.europa.esig.dss.cades.validation.CAdESSignature
- All Implemented Interfaces:
AdvancedSignature,Serializable
- Direct Known Subclasses:
PAdESSignature
public class CAdESSignature extends DefaultAdvancedSignature
CAdES Signature class helper
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.europa.esig.dss.validation.DefaultAdvancedSignature
DefaultAdvancedSignature.ValidationDataForInclusion -
Field Summary
Fields inherited from class eu.europa.esig.dss.validation.DefaultAdvancedSignature
candidatesForSigningCertificate, certPool, detachedContents, manifestFiles, offlineCertificateSource, providedSigningCertificateToken, referenceValidations, signatureCRLSource, signatureCryptographicVerification, signatureIdentifier, signatureOCSPSource, signaturePolicy, signatureTimestampSource, structureValidation -
Constructor Summary
Constructors Constructor Description CAdESSignature(byte[] data)CAdESSignature(byte[] data, CertificatePool certPool)CAdESSignature(org.bouncycastle.cms.CMSSignedData cms, CertificatePool certPool)The default constructor for CAdESSignature.CAdESSignature(org.bouncycastle.cms.CMSSignedData cms, CertificatePool certPool, List<DSSDocument> detachedContents)CAdESSignature(org.bouncycastle.cms.CMSSignedData cmsSignedData, org.bouncycastle.cms.SignerInformation signerInformation)CAdESSignature(org.bouncycastle.cms.CMSSignedData cmsSignedData, org.bouncycastle.cms.SignerInformation signerInformation, CertificatePool certPool)The default constructor for CAdESSignature. -
Method Summary
Modifier and Type Method Description protected SignatureIdentifierbuildSignatureIdentifier()Build and definessignatureIdentifiervaluevoidcheckSignatureIntegrity()Verifies the signature integrity; checks if the signed content has not been tampered with.voidcheckSignaturePolicy(SignaturePolicyProvider signaturePolicyProvider)voidcheckSigningCertificate()This method checks the protection of the certificates included within the signature (XAdES: KeyInfo) against the substitution attack.CandidatesForSigningCertificategetCandidatesForSigningCertificate()ETSI TS 101 733 V2.2.1 (2013-04) 5.6.3 Signature Verification Process ...the public key from the first certificate identified in the sequence of certificate identifiers from SigningCertificate shall be the key used to verify the digital signature.List<CertificateRef>getCertificateRefs()Retrieve list of certificate refSignatureCertificateSourcegetCertificateSource()Gets a certificate source which contains ALL certificates embedded in the signature.List<SignerRole>getCertifiedSignerRoles()Returns the certified roles of the signer.List<SignerRole>getClaimedSignerRoles()Returns the claimed roles of the signer.org.bouncycastle.cms.CMSSignedDatagetCmsSignedData()CommitmentTypegetCommitmentTypeIndication()This method obtains the information concerning commitment type indication linked to the signatureStringgetContentHints()StringgetContentIdentifier()StringgetContentType()Returns the value of the signed attribute content-typeList<AdvancedSignature>getCounterSignatures()Returns a list of counter signatures applied to this signatureSignatureCRLSourcegetCRLSource()Gets a CRL source which contains ALL CRLs embedded in the signature.StringgetDAIdentifier()This method returns an identifier provided by the Driving Application (DA) Note: used only for XAdESDigestAlgorithmgetDigestAlgorithm()Retrieves the digest algorithm used for generating the signature.EncryptionAlgorithmgetEncryptionAlgorithm()Retrieves the encryption algorithm used for generating the signature.MaskGenerationFunctiongetMaskGenerationFunction()Retrieves the mask generation function used for generating the signature.Set<DigestAlgorithm>getMessageDigestAlgorithms()byte[]getMessageDigestValue()StringgetMimeType()Returns the value of the signed attribute mime-typeSignatureOCSPSourcegetOCSPSource()Gets an OCSP source which contains ALL OCSP responses embedded in the signature.DSSDocumentgetOriginalDocument()DigestAlgorithmgetPSSHashAlgorithm()List<ReferenceValidation>getReferenceValidations()Returns individual validation foreach reference (XAdES) or for the message-imprint (CAdES)List<ReferenceValidation>getReferenceValidations(org.bouncycastle.cms.SignerInformation signerInformationToCheck)SignatureAlgorithmgetSignatureAlgorithm()Retrieves the signature algorithm (or cipher) used for generating the signature.SignatureDigestReferencegetSignatureDigestReference(DigestAlgorithm digestAlgorithm)TS 119 442 - V1.1.1 - Electronic Signatures and Infrastructures (ESI), ch.SignatureFormgetSignatureForm()Specifies the format of the signatureSignatureLevel[]getSignatureLevels()SignatureProductionPlacegetSignatureProductionPlace()Returns information about the place where the signature was generatedbyte[]getSignatureValue()Returns the digital signature valueorg.bouncycastle.cms.SignerIdgetSignerId()ReturnsSignerIdof the related to the signaturesignerInformationorg.bouncycastle.cms.SignerInformationgetSignerInformation()DategetSigningTime()Returns the signing time included within the signature.List<TimestampedReference>getTimestampReferencesForArchiveTimestamp(List<TimestampToken> timestampedTimestamps)CAdESTimestampSourcegetTimestampSource()Gets a Signature Timestamp source which contains ALL timestamps embedded in the signature.booleanisCounterSignature()Checks if the signature is a counter signaturebooleanisDataForSignatureLevelPresent(SignatureLevel signatureLevel)Methods inherited from class eu.europa.esig.dss.validation.DefaultAdvancedSignature
addEncapsulatedCertificatesFromTimestamp, addExternalTimestamp, addReference, addReferences, addReferencesForCertificates, addReferencesForPreviousTimestamps, addReferencesFromRevocationData, areAllSelfSignedCertificates, equals, findRefsForRevocationIdentifier, findRefsForRevocationToken, findSignatureScope, getAllFoundRevocationIdentifiers, getAllRevocationTokens, getAllTimestamps, getArchiveTimestamps, getAttributeRevocationCRLReferences, getAttributeRevocationOCSPReferences, getAttributeRevocationTokens, getAttributeRevocationValuesTokens, getCertificateListWithinSignatureAndTimestamps, getCertificateMapWithinSignatureAndTimestamps, getCertificates, getCMSSignedDataRevocationTokens, getCompleteCRLSource, getCompleteOCSPSource, getCompleteRevocationCRLReferences, getCompleteRevocationOCSPReferences, getCompleteRevocationTokens, getContainerContents, getContentTimestampReferences, getContentTimestamps, getDataFoundUpToLevel, getDetachedContents, getDocumentTimestamps, getDSSDictionaryRevocationTokens, getDSSId, getId, getManifestedDocuments, getMasterSignature, getOrphanCertificateRefs, getOrphanRevocationRefs, getPdfRevision, getPolicyId, getProvidedSigningCertificateToken, getRevocationValuesTokens, getSignatureCryptographicVerification, getSignatureFilename, getSignatureScopes, getSignatureTimestampReferences, getSignatureTimestamps, getSignatureValidationContext, getSignerRoles, getSigningCertificateTimestampReferences, getSigningCertificateToken, getStructureValidationResult, getTimestampedReferencesFromCertificates, getTimestampRevocationCRLReferences, getTimestampRevocationOCSPReferences, getTimestampSignedDataRevocationTokens, getTimestampSourceCertificates, getTimestampsX1, getTimestampsX2, getTimestampValidationDataTokens, getValidationDataForInclusion, getVRIDictionaryRevocationTokens, hashCode, hasLTAProfile, hasLTProfile, hasTProfile, isDocHashOnlyValidation, isHashOnlyValidation, prepareTimestamps, setContainerContents, setDetachedContents, setManifestFiles, setMasterSignature, setProvidedSigningCertificateToken, setSignatureFilename, validateStructure
-
Constructor Details
-
CAdESSignature
public CAdESSignature(byte[] data) throws org.bouncycastle.cms.CMSException- Parameters:
data- byte array representing CMSSignedData- Throws:
org.bouncycastle.cms.CMSException
-
CAdESSignature
public CAdESSignature(byte[] data, CertificatePool certPool) throws org.bouncycastle.cms.CMSException- Parameters:
data- byte array representing CMSSignedDatacertPool- can be null- Throws:
org.bouncycastle.cms.CMSException
-
CAdESSignature
The default constructor for CAdESSignature.- Parameters:
cms- CMSSignedDatacertPool- can be null
-
CAdESSignature
public CAdESSignature(org.bouncycastle.cms.CMSSignedData cms, CertificatePool certPool, List<DSSDocument> detachedContents) -
CAdESSignature
public CAdESSignature(org.bouncycastle.cms.CMSSignedData cmsSignedData, org.bouncycastle.cms.SignerInformation signerInformation)- Parameters:
cmsSignedData- CMSSignedDatasignerInformation- an expanded SignerInfo block from a CMS Signed message
-
CAdESSignature
public CAdESSignature(org.bouncycastle.cms.CMSSignedData cmsSignedData, org.bouncycastle.cms.SignerInformation signerInformation, CertificatePool certPool)The default constructor for CAdESSignature.- Parameters:
cmsSignedData- CMSSignedDatasignerInformation- an expanded SignerInfo block from a CMS Signed messagecertPool- can be null
-
-
Method Details
-
getSignatureForm
Description copied from interface:AdvancedSignatureSpecifies the format of the signature -
getCertificateSource
Description copied from interface:AdvancedSignatureGets a certificate source which contains ALL certificates embedded in the signature.- Returns:
-
getCRLSource
Description copied from interface:AdvancedSignatureGets a CRL source which contains ALL CRLs embedded in the signature.- Returns:
SignatureCRLSource
-
getOCSPSource
Description copied from interface:AdvancedSignatureGets an OCSP source which contains ALL OCSP responses embedded in the signature.- Returns:
SignatureOCSPSource
-
getTimestampSource
Description copied from interface:AdvancedSignatureGets a Signature Timestamp source which contains ALL timestamps embedded in the signature.- Returns:
SignatureTimestampSource
-
getSignerId
public org.bouncycastle.cms.SignerId getSignerId()ReturnsSignerIdof the related to the signaturesignerInformation- Returns:
SignerId
-
getCandidatesForSigningCertificate
ETSI TS 101 733 V2.2.1 (2013-04) 5.6.3 Signature Verification Process ...the public key from the first certificate identified in the sequence of certificate identifiers from SigningCertificate shall be the key used to verify the digital signature.- Returns:
-
checkSignaturePolicy
-
getSigningTime
Description copied from interface:AdvancedSignatureReturns the signing time included within the signature.- Returns:
Daterepresenting the signing time or null
-
getCmsSignedData
public org.bouncycastle.cms.CMSSignedData getCmsSignedData()- Returns:
- the cmsSignedData
-
getSignatureProductionPlace
Description copied from interface:AdvancedSignatureReturns information about the place where the signature was generated- Returns:
SignatureProductionPlace
-
getCommitmentTypeIndication
Description copied from interface:AdvancedSignatureThis method obtains the information concerning commitment type indication linked to the signature- Returns:
CommitmentType
-
getClaimedSignerRoles
Description copied from interface:AdvancedSignatureReturns the claimed roles of the signer.- Returns:
- list of the
SignerRoles
-
getCertifiedSignerRoles
Description copied from interface:AdvancedSignatureReturns the certified roles of the signer.- Returns:
- list of the
SignerRoles
-
getTimestampReferencesForArchiveTimestamp
public List<TimestampedReference> getTimestampReferencesForArchiveTimestamp(List<TimestampToken> timestampedTimestamps) -
getEncryptionAlgorithm
Description copied from interface:AdvancedSignatureRetrieves the encryption algorithm used for generating the signature.- Returns:
EncryptionAlgorithm
-
getDigestAlgorithm
Description copied from interface:AdvancedSignatureRetrieves the digest algorithm used for generating the signature.- Returns:
DigestAlgorithm
-
getPSSHashAlgorithm
-
getMaskGenerationFunction
Description copied from interface:AdvancedSignatureRetrieves the mask generation function used for generating the signature.- Returns:
MaskGenerationFunction
-
getSignatureAlgorithm
Description copied from interface:AdvancedSignatureRetrieves the signature algorithm (or cipher) used for generating the signature.- Returns:
SignatureAlgorithm
-
checkSignatureIntegrity
public void checkSignatureIntegrity()Description copied from interface:AdvancedSignatureVerifies the signature integrity; checks if the signed content has not been tampered with. In the case of a non-AdES signature no including the signing certificate then the latter must be provided by callingsetProvidedSigningCertificateTokenIn the case of a detached signature the signed content must be provided by callingsetProvidedSigningCertificateToken -
getReferenceValidations
public List<ReferenceValidation> getReferenceValidations(org.bouncycastle.cms.SignerInformation signerInformationToCheck) -
getReferenceValidations
Description copied from interface:AdvancedSignatureReturns individual validation foreach reference (XAdES) or for the message-imprint (CAdES)- Returns:
- a list with one or more
ReferenceValidation
-
getSignatureDigestReference
TS 119 442 - V1.1.1 - Electronic Signatures and Infrastructures (ESI), ch. 5.1.4.2.1.3 XML component: In case of CAdES signatures, the input to the digest value computation shall be one of the DER-encoded instances of SignedInfo type present within the CMS structure.- Parameters:
digestAlgorithm-DigestAlgorithmto use- Returns:
SignatureDigestReference
-
checkSigningCertificate
public void checkSigningCertificate()Description copied from interface:AdvancedSignatureThis method checks the protection of the certificates included within the signature (XAdES: KeyInfo) against the substitution attack. -
getMessageDigestAlgorithms
-
getMessageDigestValue
public byte[] getMessageDigestValue()- Specified by:
getMessageDigestValuein interfaceAdvancedSignature- Overrides:
getMessageDigestValuein classDefaultAdvancedSignature
-
getContentType
Description copied from interface:AdvancedSignatureReturns the value of the signed attribute content-type- Returns:
- content type as
String
-
getMimeType
Description copied from interface:AdvancedSignatureReturns the value of the signed attribute mime-type- Returns:
- mime type as
String
-
getContentIdentifier
- Returns:
- content identifier as
String
-
getContentHints
- Returns:
- content hints as
String
-
getSignerInformation
public org.bouncycastle.cms.SignerInformation getSignerInformation()- Returns:
- the signerInformation
-
getSignatureValue
public byte[] getSignatureValue()Description copied from interface:AdvancedSignatureReturns the digital signature value- Returns:
- digital signature value byte array
-
isCounterSignature
public boolean isCounterSignature()Checks if the signature is a counter signature- Returns:
- TRUE if the signature is a counter signature, FALSE otherwise
-
getCounterSignatures
Description copied from interface:AdvancedSignatureReturns a list of counter signatures applied to this signature- Returns:
- a
ListofAdvancedSignaturesrepresenting the counter signatures
-
getCertificateRefs
Description copied from interface:AdvancedSignatureRetrieve list of certificate ref- Returns:
ListofCertificateRef
-
getOriginalDocument
- Throws:
DSSException
-
buildSignatureIdentifier
Description copied from class:DefaultAdvancedSignatureBuild and definessignatureIdentifiervalue- Specified by:
buildSignatureIdentifierin classDefaultAdvancedSignature
-
getDAIdentifier
Description copied from interface:AdvancedSignatureThis method returns an identifier provided by the Driving Application (DA) Note: used only for XAdES- Returns:
- The signature identifier
-
isDataForSignatureLevelPresent
- Parameters:
signatureLevel-SignatureLevelto be checked- Returns:
- true if the signature contains the data needed for this
SignatureLevel. Doesn't mean any validity of the data found.
-
getSignatureLevels
- Returns:
- the list of signature levels for this type of signature, in the simple to complete order. Example: B,T,LT,LTA
-