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
-
Field Summary
Fields inherited from class eu.europa.esig.dss.validation.DefaultAdvancedSignature
detachedContents, manifestFiles, offlineCertificateSource, providedSigningCertificateToken, referenceValidations, signatureCRLSource, signatureCryptographicVerification, signatureIdentifier, signatureOCSPSource, signaturePolicy, signatureTimestampSource, structureValidation
-
Constructor Summary
Constructors Constructor Description CAdESSignature(org.bouncycastle.cms.CMSSignedData cmsSignedData, org.bouncycastle.cms.SignerInformation signerInformation)
The default constructor for CAdESSignature. -
Method Summary
Modifier and Type Method Description protected SignatureIdentifier
buildSignatureIdentifier()
Build and definessignatureIdentifier
valuevoid
checkSignatureIntegrity()
Verifies the signature integrity; checks if the signed content has not been tampered with.void
checkSignaturePolicy(SignaturePolicyProvider signaturePolicyProvider)
SignatureCertificateSource
getCertificateSource()
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.CMSSignedData
getCmsSignedData()
List<CommitmentTypeIndication>
getCommitmentTypeIndications()
This method obtains the information concerning commitment type indication linked to the signatureString
getContentHints()
String
getContentIdentifier()
String
getContentType()
Returns the value of the signed attribute content-typeList<AdvancedSignature>
getCounterSignatures()
Returns a list of counter signatures applied to this signatureOfflineCRLSource
getCRLSource()
Gets a CRL source which contains ALL CRLs embedded in the signature.String
getDAIdentifier()
This method returns an identifier provided by the Driving Application (DA) Note: used only for XAdESSignatureLevel
getDataFoundUpToLevel()
This method returns the signature levelDigestAlgorithm
getDigestAlgorithm()
Retrieves the digest algorithm used for generating the signature.EncryptionAlgorithm
getEncryptionAlgorithm()
Retrieves the encryption algorithm used for generating the signature.MaskGenerationFunction
getMaskGenerationFunction()
Retrieves the mask generation function used for generating the signature.Set<DigestAlgorithm>
getMessageDigestAlgorithms()
byte[]
getMessageDigestValue()
Returns a digest value incorporated in an attribute "message-digest" in CMS Signed DataString
getMimeType()
Returns the value of the signed attribute mime-typeOfflineOCSPSource
getOCSPSource()
Gets an OCSP source which contains ALL OCSP responses embedded in the signature.DSSDocument
getOriginalDocument()
DigestAlgorithm
getPSSHashAlgorithm()
List<ReferenceValidation>
getReferenceValidations()
Returns individual validation foreach reference (XAdES) or for the message-imprint (CAdES)List<ReferenceValidation>
getReferenceValidations(org.bouncycastle.cms.SignerInformation signerInformationToCheck)
SignatureAlgorithm
getSignatureAlgorithm()
Retrieves the signature algorithm (or cipher) used for generating the signature.SignatureDigestReference
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.SignatureForm
getSignatureForm()
Specifies the format of the signatureSignatureLevel[]
getSignatureLevels()
SignatureProductionPlace
getSignatureProductionPlace()
Returns information about the place where the signature was generatedbyte[]
getSignatureValue()
Returns the digital signature valueList<SignerRole>
getSignedAssertions()
Returns the list of embeded signed assertions.org.bouncycastle.cms.SignerId
getSignerId()
ReturnsSignerId
of the related to the signaturesignerInformation
org.bouncycastle.cms.SignerInformation
getSignerInformation()
Set<CertificateIdentifier>
getSignerInformationStoreInfos()
Returns a Set of CertificateIdentifier extracted from a SignerInformationStore of CMS Signed DataDate
getSigningTime()
Returns the signing time included within the signature.CAdESTimestampSource
getTimestampSource()
Gets a Signature Timestamp source which contains ALL timestamps embedded in the signature.boolean
hasAProfile()
boolean
hasBProfile()
boolean
hasCProfile()
boolean
hasXProfile()
boolean
isCounterSignature()
Checks if the current signature is a counter signature (i.e. has a Master signature)Methods inherited from class eu.europa.esig.dss.validation.DefaultAdvancedSignature
addExternalTimestamp, areAllSelfSignedCertificates, equals, findSignatureScope, getAllTimestamps, getArchiveTimestamps, getCandidatesForSigningCertificate, getCertificates, getCertificateSourcesExceptLastArchiveTimestamp, getCompleteCertificateSource, getCompleteCRLSource, getCompleteOCSPSource, getContainerContents, getContentTimestamps, getDetachedContents, getDocumentTimestamps, getDSSId, getId, getManifestedDocuments, getMasterSignature, getPdfRevision, getPolicyId, getProvidedSigningCertificateToken, getSignatureCryptographicVerification, getSignatureFilename, getSignatureScopes, getSignatureTimestamps, getSignatureValidationContext, getSignerRoles, getSigningCertificateToken, getStructureValidationResult, getTimestampsX1, getTimestampsX2, hashCode, hasLTAProfile, hasLTProfile, hasTProfile, isDocHashOnlyValidation, isHashOnlyValidation, prepareOfflineCertificateVerifier, prepareTimestamps, setContainerContents, setDetachedContents, setManifestFiles, setMasterSignature, setProvidedSigningCertificateToken, setSignatureFilename, 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:AdvancedSignature
Specifies the format of the signature -
getCertificateSource
Description copied from interface:AdvancedSignature
Gets a certificate source which contains ALL certificates embedded in the signature.- Returns:
-
getCRLSource
Description copied from interface:AdvancedSignature
Gets a CRL source which contains ALL CRLs embedded in the signature.- Returns:
OfflineRevocationSource
-
getOCSPSource
Description copied from interface:AdvancedSignature
Gets an OCSP source which contains ALL OCSP responses embedded in the signature.- Returns:
OfflineRevocationSource
-
getTimestampSource
Description copied from interface:AdvancedSignature
Gets a Signature Timestamp source which contains ALL timestamps embedded in the signature.- Returns:
SignatureTimestampSource
-
getSignerId
public org.bouncycastle.cms.SignerId getSignerId()ReturnsSignerId
of the related to the signaturesignerInformation
- Returns:
SignerId
-
checkSignaturePolicy
-
getSigningTime
Description copied from interface:AdvancedSignature
Returns the signing time included within the signature.- Returns:
Date
representing the signing time or null
-
getCmsSignedData
public org.bouncycastle.cms.CMSSignedData getCmsSignedData()- Returns:
- the cmsSignedData
-
getSignatureProductionPlace
Description copied from interface:AdvancedSignature
Returns information about the place where the signature was generated- Returns:
SignatureProductionPlace
-
getCommitmentTypeIndications
Description copied from interface:AdvancedSignature
This method obtains the information concerning commitment type indication linked to the signature- Returns:
- a list of
CommitmentTypeIndication
s
-
getSignedAssertions
Description copied from interface:AdvancedSignature
Returns the list of embeded signed assertions.- Returns:
- list of the assertions s
-
getClaimedSignerRoles
Description copied from interface:AdvancedSignature
Returns the claimed roles of the signer.- Returns:
- list of the
SignerRole
s
-
getCertifiedSignerRoles
Description copied from interface:AdvancedSignature
Returns the certified roles of the signer.- Returns:
- list of the
SignerRole
s
-
getEncryptionAlgorithm
Description copied from interface:AdvancedSignature
Retrieves the encryption algorithm used for generating the signature.- Returns:
EncryptionAlgorithm
-
getDigestAlgorithm
Description copied from interface:AdvancedSignature
Retrieves the digest algorithm used for generating the signature.- Returns:
DigestAlgorithm
-
getPSSHashAlgorithm
-
getMaskGenerationFunction
Description copied from interface:AdvancedSignature
Retrieves the mask generation function used for generating the signature.- Returns:
MaskGenerationFunction
-
getSignatureAlgorithm
Description copied from interface:AdvancedSignature
Retrieves the signature algorithm (or cipher) used for generating the signature.- Returns:
SignatureAlgorithm
-
checkSignatureIntegrity
public void checkSignatureIntegrity()Description copied from interface:AdvancedSignature
Verifies 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 callingsetProvidedSigningCertificateToken
In 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:AdvancedSignature
Returns 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
-DigestAlgorithm
to use- Returns:
SignatureDigestReference
-
getMessageDigestAlgorithms
-
getMessageDigestValue
public byte[] getMessageDigestValue()Description copied from interface:AdvancedSignature
Returns a digest value incorporated in an attribute "message-digest" in CMS Signed Data- Specified by:
getMessageDigestValue
in interfaceAdvancedSignature
- Overrides:
getMessageDigestValue
in classDefaultAdvancedSignature
- Returns:
- a byte array representing a signed content digest value
-
getContentType
Description copied from interface:AdvancedSignature
Returns the value of the signed attribute content-type- Returns:
- content type as
String
-
getMimeType
Description copied from interface:AdvancedSignature
Returns 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:AdvancedSignature
Returns the digital signature value- Returns:
- digital signature value byte array
-
isCounterSignature
public boolean isCounterSignature()Description copied from interface:AdvancedSignature
Checks if the current signature is a counter signature (i.e. has a Master signature)- Specified by:
isCounterSignature
in interfaceAdvancedSignature
- Overrides:
isCounterSignature
in classDefaultAdvancedSignature
- Returns:
- TRUE if it is a counter signature, FALSE otherwise
-
getCounterSignatures
Description copied from interface:AdvancedSignature
Returns a list of counter signatures applied to this signature- Returns:
- a
List
ofAdvancedSignatures
representing the counter signatures
-
getOriginalDocument
- Throws:
DSSException
-
buildSignatureIdentifier
Description copied from class:DefaultAdvancedSignature
Build and definessignatureIdentifier
value- Specified by:
buildSignatureIdentifier
in classDefaultAdvancedSignature
-
getDAIdentifier
Description copied from interface:AdvancedSignature
This method returns an identifier provided by the Driving Application (DA) Note: used only for XAdES- Returns:
- The signature identifier
-
getSignerInformationStoreInfos
Description copied from interface:AdvancedSignature
Returns a Set of CertificateIdentifier extracted from a SignerInformationStore of CMS Signed Data- Specified by:
getSignerInformationStoreInfos
in interfaceAdvancedSignature
- Overrides:
getSignerInformationStoreInfos
in classDefaultAdvancedSignature
- Returns:
- a Set of
CertificateIdentifier
s
-
getDataFoundUpToLevel
Description copied from interface:AdvancedSignature
This method returns the signature level- Returns:
- a value of
SignatureLevel
-
hasBProfile
public boolean hasBProfile() -
hasCProfile
public boolean hasCProfile() -
hasXProfile
public boolean hasXProfile() -
hasAProfile
public boolean hasAProfile() -
getSignatureLevels
- Returns:
- the list of signature levels for this type of signature, in the simple to complete order. Example: B,T,LT,LTA
-