Package eu.europa.esig.dss.xades
Class XAdESSignatureParameters
java.lang.Object
eu.europa.esig.dss.model.AbstractSerializableSignatureParameters<XAdESTimestampParameters>
eu.europa.esig.dss.signature.AbstractSignatureParameters<XAdESTimestampParameters>
eu.europa.esig.dss.xades.XAdESSignatureParameters
- All Implemented Interfaces:
SerializableSignatureParameters,Serializable
- Direct Known Subclasses:
ASiCWithXAdESSignatureParameters,XAdESCounterSignatureParameters
Defines SignatureParameters to deal with XAdES signature creation/extension
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration defining ways to embed a signature -
Field Summary
Fields inherited from class eu.europa.esig.dss.signature.AbstractSignatureParameters
contextFields inherited from class eu.europa.esig.dss.model.AbstractSerializableSignatureParameters
archiveTimestampParameters, contentTimestampParameters, signatureTimestampParameters -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor instantiating object with null values -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the parameters for archive timestamp (Baseline-LTA)Get the parameters for content timestamp (Baseline-B)Gets the signature creation context (internal variable)Gets a list of custom xades:DataObjectFormat elementsReturns the canonicalization algorithm used for dealing with KeyInfoGets the list of custom ds:Object elementsReturns a list of references to be incorporated to the signatureReturns the root document for INTERNALLY_DETACHED signature creationGet the parameters for signature timestamp (Baseline-T)byte[]Gets a custom XAdES Object contentGets the SignedInfo canonicalization algorithmGets the SignedProperties canonicalization algorithmGets aDigestAlgorithmto create CompleteCertificateRefs/CompleteRevocationRefs withThis method returns the current used XAdES 1.4.1 namespace Never returns nullThis method returns the current used XAdES namespace Never returns nullThis method returns the current used XMLDSig namespace Never returns nullReturns the XPath element placement for Enveloped signature creationGets the xPath signature location string (ENVELOPED only)inthashCode()booleanGets if the<ds:X509Data>element shall be addedbooleanGets if the signed content shall be incorporated as XML (used for ENVELOPING)booleanGets if the signature shall be created according to ETSI EN 319 132booleanGets if the signature signs a manifestbooleanGets if the signature shall be pretty-printedbooleanReturns value value specifying if "KeyInfo" element should be signed.voidreinit()This method re-inits signature parameters to clean temporary settingsvoidsetAddX509SubjectName(boolean addX509SubjectName) Sets if the<ds:X509Data>element shall be addedvoidsetDataObjectFormatList(List<DSSDataObjectFormat> dataObjectFormatList) Sets a list of custom xades:DataObjectFormat elements to be incorporated within xades:SignedDataObjectProperties element of the signature.voidsetEmbedXML(boolean embedXML) Sets if the signed content shall be incorporated as XML (used for ENVELOPING) If false, incorporates the document content in its base64 encoded representationvoidsetEn319132(boolean en319132) Sets if the signature shall be created according to ETSI EN 319 132-1voidsetKeyInfoCanonicalizationMethod(String keyInfoCanonicalizationMethod) Set the canonicalization algorithm used for dealing with KeyInfo.voidsetManifestSignature(boolean manifestSignature) Sets if the signature signs a manifestvoidsetObjects(List<DSSObject> objects) Sets the list of custom ds:Object elements to be incorporated within the ds:SignaturevoidsetPrettyPrint(boolean prettyPrint) Sets if the signature shall be pretty-printedvoidsetReferences(List<DSSReference> references) Sets a list of references to be incorporated into the signature NOTE: This method overwrites a default behavior on ds:Reference's creation.voidsetRootDocument(DSSDocument rootDocument) Sets the root XML document for a signature creation.voidsetRootDocument(Document rootDocument) Sets the root document for INTERNALLY_DETACHED signature creationvoidsetSignatureLevel(SignatureLevel signatureLevel) Set signature level.voidsetSignedAdESObject(byte[] signedAdESObject) Sets a custom XAdES Object contentvoidsetSignedInfoCanonicalizationMethod(String signedInfoCanonicalizationMethod) Set the canonicalization algorithm to be used when dealing with SignedInfo.voidsetSignedPropertiesCanonicalizationMethod(String signedPropertiesCanonicalizationMethod) Set the canonicalization algorithm to be used when dealing with SignedProperties.voidsetSigningCertificateDigestMethod(DigestAlgorithm signingCertificateDigestMethod) This property is a part of the standard:
7.2.2 The SigningCertificate element (101 903 V1.4.2 (2010-12) XAdES)
The digest method indicates the digest algorithm to be used to calculate the CertDigest element that contains the digest for each certificate referenced in the sequence.voidsetSignKeyInfo(boolean signKeyInfo) Set the parameter SignKeyInfo defining if the "KeyInfo" element must be signed and its reference must be included to "SignedInfo" element.voidsetTokenReferencesDigestAlgorithm(DigestAlgorithm tokenReferencesDigestAlgorithm) Sets aDigestAlgorithmto create CompleteCertificateRefs/CompleteRevocationRefs for -C levelvoidsetXades141Namespace(DSSNamespace xades141Namespace) Sets the XAdES 1.4.1 namespacevoidsetXadesNamespace(DSSNamespace xadesNamespace) Sets the XAdES namespacevoidsetXmldsigNamespace(DSSNamespace xmldsigNamespace) Sets the XMLDSIG namespacevoidsetXPathElementPlacement(XAdESSignatureParameters.XPathElementPlacement xPathElementPlacement) Defines the relation to the element referenced by the XPath where the signature will be added (XAdES Enveloped)voidsetXPathLocationString(String xPathLocationString) Defines the position where the signature will be added (XAdES Enveloped)toString()Methods inherited from class eu.europa.esig.dss.signature.AbstractSignatureParameters
getCertificateChain, getContentTimestamps, getDetachedContents, getDeterministicId, getSignedData, getSigningCertificate, setCertificateChain, setCertificateChain, setContentTimestamps, setDetachedContents, setSignedData, setSigningCertificateMethods inherited from class eu.europa.esig.dss.model.AbstractSerializableSignatureParameters
bLevel, getDigestAlgorithm, getEncryptionAlgorithm, getReferenceDigestAlgorithm, getSignatureAlgorithm, getSignatureLevel, getSignaturePackaging, getValidationDataEncapsulationStrategy, isCheckCertificateRevocation, isGenerateTBSWithoutCertificate, setArchiveTimestampParameters, setBLevelParams, setCheckCertificateRevocation, setContentTimestampParameters, setDigestAlgorithm, setEncryptionAlgorithm, setGenerateTBSWithoutCertificate, setReferenceDigestAlgorithm, setSignaturePackaging, setSignatureTimestampParameters, setValidationDataEncapsulationStrategy
-
Constructor Details
-
XAdESSignatureParameters
public XAdESSignatureParameters()Default constructor instantiating object with null values
-
-
Method Details
-
setSignatureLevel
Description copied from class:AbstractSerializableSignatureParametersSet signature level. This field cannot be null.- Overrides:
setSignatureLevelin classAbstractSerializableSignatureParameters<XAdESTimestampParameters>- Parameters:
signatureLevel- the expected signature level
-
setSigningCertificateDigestMethod
This property is a part of the standard:
7.2.2 The SigningCertificate element (101 903 V1.4.2 (2010-12) XAdES)
The digest method indicates the digest algorithm to be used to calculate the CertDigest element that contains the digest for each certificate referenced in the sequence. Default: SHA512 (DigestAlgorithm.SHA512)- Parameters:
signingCertificateDigestMethod-DigestAlgorithm
-
getSigningCertificateDigestMethod
- Returns:
DigestAlgorithm
-
getSignedInfoCanonicalizationMethod
Gets the SignedInfo canonicalization algorithm- Returns:
- the canonicalization algorithm to be used when dealing with SignedInfo.
-
setSignedInfoCanonicalizationMethod
Set the canonicalization algorithm to be used when dealing with SignedInfo.- Parameters:
signedInfoCanonicalizationMethod- the canonicalization algorithm to be used when dealing with SignedInfo.
-
getSignedPropertiesCanonicalizationMethod
Gets the SignedProperties canonicalization algorithm- Returns:
- the canonicalization algorithm to be used when dealing with SignedProperties.
-
setSignedPropertiesCanonicalizationMethod
public void setSignedPropertiesCanonicalizationMethod(String signedPropertiesCanonicalizationMethod) Set the canonicalization algorithm to be used when dealing with SignedProperties.- Parameters:
signedPropertiesCanonicalizationMethod- the canonicalization algorithm to be used when dealing with SignedInfo.
-
getKeyInfoCanonicalizationMethod
Returns the canonicalization algorithm used for dealing with KeyInfo- Returns:
- - name of the canonicalization algorithm
-
setKeyInfoCanonicalizationMethod
Set the canonicalization algorithm used for dealing with KeyInfo.- Parameters:
keyInfoCanonicalizationMethod- - name of the canonicalization algorithm for dealing with KeyInfo.
-
isSignKeyInfo
public boolean isSignKeyInfo()Returns value value specifying if "KeyInfo" element should be signed.- Returns:
- TRUE if "KeyInfo" element must be signed, FALSE otherwise.
-
setSignKeyInfo
public void setSignKeyInfo(boolean signKeyInfo) Set the parameter SignKeyInfo defining if the "KeyInfo" element must be signed and its reference must be included to "SignedInfo" element. The value is FALSE by default.- Parameters:
signKeyInfo- - if KeyInfo element should be signed
-
getReferences
Returns a list of references to be incorporated to the signature- Returns:
- a list of
DSSReferences
-
setReferences
Sets a list of references to be incorporated into the signature NOTE: This method overwrites a default behavior on ds:Reference's creation. It should be used only by experienced users.- Parameters:
references- a list ofDSSReferences
-
getXPathLocationString
Gets the xPath signature location string (ENVELOPED only)- Returns:
StringxPath
-
setXPathLocationString
Defines the position where the signature will be added (XAdES Enveloped)- Parameters:
xPathLocationString- the xpath position of the signature
-
getXPathElementPlacement
Returns the XPath element placement for Enveloped signature creation -
setXPathElementPlacement
public void setXPathElementPlacement(XAdESSignatureParameters.XPathElementPlacement xPathElementPlacement) Defines the relation to the element referenced by the XPath where the signature will be added (XAdES Enveloped)- Parameters:
xPathElementPlacement- the placement of the signature
-
getRootDocument
Returns the root document for INTERNALLY_DETACHED signature creation- Returns:
Document
-
setRootDocument
Sets the root document for INTERNALLY_DETACHED signature creation- Parameters:
rootDocument-Document
-
setRootDocument
Sets the root XML document for a signature creation. This method expected arootDocumentto be represented by a valid XML document- Parameters:
rootDocument-DSSDocumentrepresented by an XML document
-
getContext
Gets the signature creation context (internal variable)- Overrides:
getContextin classAbstractSignatureParameters<XAdESTimestampParameters>- Returns:
XAdESProfileParameters
-
isEn319132
public boolean isEn319132()Gets if the signature shall be created according to ETSI EN 319 132- Returns:
- TRUE if the signature shall be created according to ETSI EN 319 132, otherwise according to the old standard
-
setEn319132
public void setEn319132(boolean en319132) Sets if the signature shall be created according to ETSI EN 319 132-1Default: true
- Parameters:
en319132- if the signature shall be created according to ETSI EN 319 132-1
-
isEmbedXML
public boolean isEmbedXML()Gets if the signed content shall be incorporated as XML (used for ENVELOPING)- Returns:
- TRUE if the signed content shall be incorporated as XML, FALSE otherwise (base64 encoded binaries)
-
setEmbedXML
public void setEmbedXML(boolean embedXML) Sets if the signed content shall be incorporated as XML (used for ENVELOPING) If false, incorporates the document content in its base64 encoded representationDefault: false (base64 encoded binaries)
- Parameters:
embedXML- if the signed content shall be incorporated as XML
-
isManifestSignature
public boolean isManifestSignature()Gets if the signature signs a manifest- Returns:
- TRUE if the signature signs a manifest, FALSE otherwise
-
setManifestSignature
public void setManifestSignature(boolean manifestSignature) Sets if the signature signs a manifest- Parameters:
manifestSignature- if the signature signs a manifest
-
isAddX509SubjectName
public boolean isAddX509SubjectName()Gets if the<ds:X509Data>element shall be added- Returns:
- TRUE if the X509Data element shall be added, FALSE otherwise
-
setAddX509SubjectName
public void setAddX509SubjectName(boolean addX509SubjectName) Sets if the<ds:X509Data>element shall be addedDefault: false
- Parameters:
addX509SubjectName- if the X509Data element shall be added
-
getSignedAdESObject
public byte[] getSignedAdESObject()Gets a custom XAdES Object content- Returns:
- XAdES Object binaries
-
setSignedAdESObject
public void setSignedAdESObject(byte[] signedAdESObject) Sets a custom XAdES Object content- Parameters:
signedAdESObject- XAdES Object content to incorporate into the signature
-
isPrettyPrint
public boolean isPrettyPrint()Gets if the signature shall be pretty-printed- Returns:
- TRUE if pretty-print the signature, FALSE otherwise
-
setPrettyPrint
public void setPrettyPrint(boolean prettyPrint) Sets if the signature shall be pretty-printedDefault: false
- Parameters:
prettyPrint- TRUE if to pretty-print the signature, FALSE otherwise
-
getXmldsigNamespace
This method returns the current used XMLDSig namespace Never returns null- Returns:
DSSNamespace
-
setXmldsigNamespace
Sets the XMLDSIG namespaceDefault: ds:http://www.w3.org/2000/09/xmldsig#
- Parameters:
xmldsigNamespace-DSSNamespace
-
getXadesNamespace
This method returns the current used XAdES namespace Never returns null- Returns:
DSSNamespace
-
setXadesNamespace
Sets the XAdES namespaceDefault: xades:http://uri.etsi.org/01903/v1.3.2#
- Parameters:
xadesNamespace-DSSNamespace
-
getXades141Namespace
This method returns the current used XAdES 1.4.1 namespace Never returns null- Returns:
DSSNamespace
-
setXades141Namespace
Sets the XAdES 1.4.1 namespaceDefault: xades141:http://uri.etsi.org/01903/v1.4.1#
- Parameters:
xades141Namespace-DSSNamespace
-
getObjects
Gets the list of custom ds:Object elements- Returns:
- a list of
DSSObjects
-
setObjects
Sets the list of custom ds:Object elements to be incorporated within the ds:Signature- Parameters:
objects- a list ofDSSObjectto be included
-
getTokenReferencesDigestAlgorithm
Gets aDigestAlgorithmto create CompleteCertificateRefs/CompleteRevocationRefs with- Returns:
DigestAlgorithm
-
setTokenReferencesDigestAlgorithm
Sets aDigestAlgorithmto create CompleteCertificateRefs/CompleteRevocationRefs for -C levelDefault: SHA512
- Parameters:
tokenReferencesDigestAlgorithm-DigestAlgorithm
-
getDataObjectFormatList
Gets a list of custom xades:DataObjectFormat elements- Returns:
- list of
DSSDataObjectFormats
-
setDataObjectFormatList
Sets a list of custom xades:DataObjectFormat elements to be incorporated within xades:SignedDataObjectProperties element of the signature. NOTE: this method overwrites default behavior on xades:DataObjectFormat creation. It should be used only by experienced users.- Parameters:
dataObjectFormatList- list ofDSSDataObjectFormats
-
getContentTimestampParameters
Description copied from class:AbstractSerializableSignatureParametersGet the parameters for content timestamp (Baseline-B)- Overrides:
getContentTimestampParametersin classAbstractSerializableSignatureParameters<XAdESTimestampParameters>- Returns:
- the parameters to produce a content timestamp
-
getSignatureTimestampParameters
Description copied from class:AbstractSerializableSignatureParametersGet the parameters for signature timestamp (Baseline-T)- Overrides:
getSignatureTimestampParametersin classAbstractSerializableSignatureParameters<XAdESTimestampParameters>- Returns:
- the parameters to produce a signature timestamp
-
getArchiveTimestampParameters
Description copied from class:AbstractSerializableSignatureParametersGet the parameters for archive timestamp (Baseline-LTA)- Overrides:
getArchiveTimestampParametersin classAbstractSerializableSignatureParameters<XAdESTimestampParameters>- Returns:
- the parameters to produce an archive timestamp
-
reinit
public void reinit()Description copied from class:AbstractSignatureParametersThis method re-inits signature parameters to clean temporary settings- Overrides:
reinitin classAbstractSignatureParameters<XAdESTimestampParameters>
-
toString
- Overrides:
toStringin classAbstractSignatureParameters<XAdESTimestampParameters>
-
equals
- Overrides:
equalsin classAbstractSignatureParameters<XAdESTimestampParameters>
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractSignatureParameters<XAdESTimestampParameters>
-