Class CAdESSignature
java.lang.Object
eu.europa.esig.dss.spi.signature.DefaultAdvancedSignature
eu.europa.esig.dss.cades.validation.CAdESSignature
- All Implemented Interfaces:
IdentifierBasedObject,AdvancedSignature,Serializable
- Direct Known Subclasses:
PAdESSignature
CAdES Signature class helper
- See Also:
-
Field Summary
Fields inherited from class eu.europa.esig.dss.spi.signature.DefaultAdvancedSignature
counterSignatures, detachedContents, manifestFile, offlineCertificateSource, referenceValidations, signatureCRLSource, signatureCryptographicVerification, signatureIdentifier, signatureOCSPSource, signaturePolicy, signatureTimestampSource, signingCertificateSource, structureValidationMessages -
Constructor Summary
ConstructorsConstructorDescriptionCAdESSignature(org.bouncycastle.cms.CMSSignedData cmsSignedData, org.bouncycastle.cms.SignerInformation signerInformation) The default constructor for CAdESSignature. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExternalTimestamp(TimestampToken timestamp) This method allows to add an external timestamp.protected SignaturePolicyThis method extracts a signature policy from a signature and builds the objectvoidVerifies the signature integrity; checks if the signed content has not been tampered with.protected CAdESBaselineRequirementsCheckercreateBaselineRequirementsChecker(CertificateVerifier certificateVerifier) Instantiates aBaselineRequirementsCheckeraccording to the signature formatprotected List<SignatureScope> Finds signature scopesprotected CAdESBaselineRequirementsCheckerReturns a cached instance of theBaselineRequirementsCheckerGets a certificate source which contains ALL certificates embedded in the signature.Returns the certified roles of the signer.Returns the claimed roles of the signer.org.bouncycastle.cms.CMSSignedDataGets CMSSignedDataThis method obtains the information concerning commitment type indication linked to the signatureGets Content HintsGets ContentIdentifier StringReturns the value of the signed attribute content-typeReturns a list of counter signatures applied to this signatureprotected org.bouncycastle.cms.SignerInformationStoreReturns a SignerInformationStore containing counter signaturesGets a CRL source which contains ALL CRLs embedded in the signature.This method returns an identifier provided by the Driving Application (DA) Note: used only for XAdESThis method returns the signature levelTS 119 102-1 (4.2.8 Data to be signed representation (DTBSR)) : The DTBS preparation component shall take the DTBSF and hash it according to the hash algorithm specified in the cryptographic suite.Retrieves the digest algorithm used for generating the signature.Retrieves the encryption algorithm used for generating the signature.Deprecated.Returns a set of usedDigestAlgorithms incorporated into the CMSSignedDatabyte[]Returns a digest value incorporated in an attribute "message-digest" in CMS Signed DataReturns the value of the signed attribute mime-typeGets an OCSP source which contains ALL OCSP responses embedded in the signature.Returns the original signed documentReturns individual validation foreach reference (XAdES, JAdES) or for the message-imprint (CAdES)getReferenceValidations(org.bouncycastle.cms.SignerInformation signerInformationToCheck) Returns the reference validationRetrieves the signature algorithm (or cipher) used for generating the signature.getSignatureDigestReference(DigestAlgorithm digestAlgorithm) 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.Specifies the format of the signatureprotected SignatureIdentifierBuilderReturns a builder to define and build a signature IdReturns the Signature Policy Store from the signatureReturns information about the place where the signature was generatedbyte[]Returns the digital signature valueReturns the list of embedded signed assertions.protected DSSDocumentThis method extracts a document content that was signed NOTE: Some differences are possible with PAdESorg.bouncycastle.cms.SignerIdReturnsSignerIdof the related to the signaturesignerInformationorg.bouncycastle.cms.SignerInformationGets a SignedInformationReturns a Set of CertificateIdentifier extracted from a SignerInformationStore of CMS Signed DataReturns the signing time included within the signature.Gets a Signature Timestamp source which contains ALL timestamps embedded in the signature.booleanChecks if the current signature is a counter signature (i.e. has a Master signature)Methods inherited from class eu.europa.esig.dss.spi.signature.DefaultAdvancedSignature
addExternalEvidenceRecord, areAllSelfSignedCertificates, equals, getAllEvidenceRecords, getAllTimestamps, getArchiveTimestamps, getCandidatesForSigningCertificate, getCertificates, getCompleteCertificateSource, getCompleteCRLSource, getCompleteOCSPSource, getContainerContents, getContentTimestamps, getCounterSignaturesCertificateSource, getCounterSignaturesCRLSource, getCounterSignaturesOCSPSource, getDetachedContents, getDetachedEvidenceRecords, getDetachedTimestamps, getDocumentTimestamps, getDSSId, getEmbeddedEvidenceRecords, getId, getManifestFile, getMasterSignature, getSignatureCryptographicVerification, getSignatureFilename, getSignaturePolicy, getSignatureScopes, getSignatureTimestamps, getSignerRoles, getSigningCertificateToken, getStructureValidationResult, getTimestampsX1, getTimestampsX2, hasAProfile, hasBESProfile, hasBProfile, hasCProfile, hasEPESProfile, hasExtendedTProfile, hashCode, hasLTAProfile, hasLTProfile, hasTProfile, hasXLProfile, hasXProfile, initBaselineRequirementsChecker, isDocHashOnlyValidation, isHashOnlyValidation, resetCertificateSource, resetRevocationSources, resetTimestampSource, setContainerContents, setDetachedContents, setManifestFile, setMasterSignature, setSignatureFilename, setSigningCertificateSource, toString, validateStructure
-
Constructor Details
-
CAdESSignature
public CAdESSignature(org.bouncycastle.cms.CMSSignedData cmsSignedData, org.bouncycastle.cms.SignerInformation signerInformation) The default constructor for CAdESSignature.- Parameters:
cmsSignedData- CMSSignedDatasignerInformation- an expanded SignerInfo block from a CMS Signed message
-
-
Method Details
-
getSignatureForm
Description copied from interface:AdvancedSignatureSpecifies the format of the signature- Returns:
SignatureForm
-
getCertificateSource
Description copied from interface:AdvancedSignatureGets a certificate source which contains ALL certificates embedded in the signature.- Returns:
SignatureCertificateSource
-
getCRLSource
Description copied from interface:AdvancedSignatureGets a CRL source which contains ALL CRLs embedded in the signature.- Returns:
OfflineRevocationSource
-
getOCSPSource
Description copied from interface:AdvancedSignatureGets an OCSP source which contains ALL OCSP responses embedded in the signature.- Returns:
OfflineRevocationSource
-
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
-
findSignatureScopes
Description copied from class:DefaultAdvancedSignatureFinds signature scopes- Specified by:
findSignatureScopesin classDefaultAdvancedSignature- Returns:
- a list of
SignatureScopes
-
buildSignaturePolicy
Description copied from class:DefaultAdvancedSignatureThis method extracts a signature policy from a signature and builds the object- Specified by:
buildSignaturePolicyin classDefaultAdvancedSignature- Returns:
SignaturePolicy
-
getSignaturePolicyStore
Description copied from interface:AdvancedSignatureReturns the Signature Policy Store from the signature- Returns:
SignaturePolicyStore
-
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()Gets CMSSignedData- Returns:
CMSSignedDatathe cmsSignedData
-
getSignatureProductionPlace
Description copied from interface:AdvancedSignatureReturns information about the place where the signature was generated- Returns:
SignatureProductionPlace
-
getCommitmentTypeIndications
Description copied from interface:AdvancedSignatureThis method obtains the information concerning commitment type indication linked to the signature- Returns:
- a list of
CommitmentTypeIndications
-
getSignedAssertions
Description copied from interface:AdvancedSignatureReturns the list of embedded signed assertions.- Returns:
- list of the assertions s
-
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
-
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
-
getMaskGenerationFunction
Deprecated.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) Returns the reference validation- Parameters:
signerInformationToCheck-SignerInformation- Returns:
- a list of
ReferenceValidations
-
getSignerDocumentContent
This method extracts a document content that was signed NOTE: Some differences are possible with PAdES- Returns:
DSSDocument
-
getReferenceValidations
Description copied from interface:AdvancedSignatureReturns individual validation foreach reference (XAdES, JAdES) 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
-
getDataToBeSignedRepresentation
Description copied from interface:AdvancedSignatureTS 119 102-1 (4.2.8 Data to be signed representation (DTBSR)) : The DTBS preparation component shall take the DTBSF and hash it according to the hash algorithm specified in the cryptographic suite.- Returns:
DigestDTBSR, which is then used to create the signature.
-
getMessageDigestAlgorithms
Returns a set of usedDigestAlgorithms incorporated into the CMSSignedData- Returns:
- a set of
DigestAlgorithms
-
getMessageDigestValue
public byte[] getMessageDigestValue()Returns a digest value incorporated in an attribute "message-digest" in CMS Signed Data- Returns:
- a byte array representing a signed content digest value
-
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
Gets ContentIdentifier String- Returns:
- content identifier as
String
-
getContentHints
-
getSignerInformation
public org.bouncycastle.cms.SignerInformation getSignerInformation()Gets a SignedInformation- Returns:
SignerInformationthe signerInformation
-
getSignatureValue
public byte[] getSignatureValue()Description copied from interface:AdvancedSignatureReturns the digital signature value- Returns:
- digital signature value byte array
-
isCounterSignature
public boolean isCounterSignature()Description copied from interface:AdvancedSignatureChecks if the current signature is a counter signature (i.e. has a Master signature)- Specified by:
isCounterSignaturein interfaceAdvancedSignature- Overrides:
isCounterSignaturein classDefaultAdvancedSignature- Returns:
- TRUE if it 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
-
getCounterSignatureStore
protected org.bouncycastle.cms.SignerInformationStore getCounterSignatureStore()Returns a SignerInformationStore containing counter signatures- Returns:
SignerInformationStore
-
getOriginalDocument
-
getSignatureIdentifierBuilder
Description copied from class:DefaultAdvancedSignatureReturns a builder to define and build a signature Id- Specified by:
getSignatureIdentifierBuilderin classDefaultAdvancedSignature- Returns:
SignatureIdentifierBuilder
-
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
-
getSignerInformationStoreInfos
Returns a Set of CertificateIdentifier extracted from a SignerInformationStore of CMS Signed Data- Returns:
- a Set of
SignerIdentifiers
-
addExternalTimestamp
Description copied from interface:AdvancedSignatureThis method allows to add an external timestamp. The given timestamp must be processed before. NOTE: The method is supported only for CAdES signatures- Parameters:
timestamp- the timestamp token
-
getDataFoundUpToLevel
Description copied from interface:AdvancedSignatureThis method returns the signature level- Returns:
- a value of
SignatureLevel
-
getBaselineRequirementsChecker
Description copied from class:DefaultAdvancedSignatureReturns a cached instance of theBaselineRequirementsChecker- Overrides:
getBaselineRequirementsCheckerin classDefaultAdvancedSignature- Returns:
BaselineRequirementsChecker
-
createBaselineRequirementsChecker
protected CAdESBaselineRequirementsChecker createBaselineRequirementsChecker(CertificateVerifier certificateVerifier) Description copied from class:DefaultAdvancedSignatureInstantiates aBaselineRequirementsCheckeraccording to the signature format- Specified by:
createBaselineRequirementsCheckerin classDefaultAdvancedSignature- Parameters:
certificateVerifier-CertificateVerifierto be used- Returns:
BaselineRequirementsChecker
-