Class XAdESBuilder
java.lang.Object
eu.europa.esig.dss.xades.signature.XAdESBuilder
- Direct Known Subclasses:
ExtensionBuilder,XAdESSignatureBuilder
public abstract class XAdESBuilder extends Object
Builds a XAdES signature
-
Field Summary
Fields Modifier and Type Field Description protected CertificateVerifiercertificateVerifierReference to the object in charge of certificates validationprotected DocumentdocumentDomThis is the variable which represents the root XML document root (with signature).protected XAdESSignatureParametersparamsThis variable is a reference to the set of parameters relating to the structure and process of the creation or extension of the electronic signature.static StringREFERENCED_DATAThe attribute used for timestamp includesstatic StringTARGETThe qualifying properties targetstatic StringURIThe URI attributeprotected XAdESPathsxadesPathsThis variable holds theXAdESPathswhich contains all constants and queries needed to cope with the default signature schema. -
Constructor Summary
Constructors Modifier Constructor Description protectedXAdESBuilder(CertificateVerifier certificateVerifier)The default constructor. -
Method Summary
Modifier and Type Method Description protected abstract voidalignNodes()protected DSSDocumentcreateXmlDocument()CreatesDSSDocumentfrom the current documentDomprotected XAdESElementgetCurrentXAdESElements()Gets a relevant class containing the list of elementsprotected XAdESPathsgetCurrentXAdESPaths()Gets a relevant class containing the list of pathsprotected DigestAlgorithmgetReferenceDigestAlgorithmOrDefault(XAdESSignatureParameters params)Returns params.referenceDigestAlgorithm if exists, params.digestAlgorithm otherwiseprotected DSSNamespacegetXades141Namespace()This method returns the current used XAdES 1.4.1 namespaceprotected DSSNamespacegetXadesNamespace()This method returns the current used XAdES namespaceprotected DSSNamespacegetXmldsigNamespace()This method returns the current used XMLDSig namespaceprotected ElementincorporateCert(Element parentDom, CertificateToken certificate)Creates Cert DOM object:protected voidincorporateCertificateRef(Element signingCertificateDom, Set<CertificateToken> certificates)Incorporates the certificate's references as a child of the given parent node.protected voidincorporateDigestMethod(Element parentDom, DigestAlgorithm digestAlgorithm)This method creates the ds:DigestMethod DOM objectprotected voidincorporateDigestValue(Element parentDom, DigestAlgorithm digestAlgorithm, DSSDocument originalDocument)This method creates the ds:DigestValue DOM object.protected voidincorporateDigestValue(Element parentDom, DigestAlgorithm digestAlgorithm, Token token)This method creates the ds:DigestValue DOM object.protected voidincorporateIssuerV1(Element parentDom, CertificateToken certificate)Incorporates IssuerSerial elementprotected voidincorporateIssuerV2(Element parentDom, CertificateToken certificate)Incorporates IssuerSerialV2 element
-
Field Details
-
REFERENCED_DATA
The attribute used for timestamp includes- See Also:
- Constant Field Values
-
TARGET
The qualifying properties target- See Also:
- Constant Field Values
-
URI
The URI attribute- See Also:
- Constant Field Values
-
xadesPaths
This variable holds theXAdESPathswhich contains all constants and queries needed to cope with the default signature schema. -
params
This variable is a reference to the set of parameters relating to the structure and process of the creation or extension of the electronic signature. -
documentDom
This is the variable which represents the root XML document root (with signature). -
certificateVerifier
Reference to the object in charge of certificates validation
-
-
Constructor Details
-
XAdESBuilder
The default constructor.- Parameters:
certificateVerifier-CertificateVerifier
-
-
Method Details
-
incorporateDigestMethod
This method creates the ds:DigestMethod DOM object<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>- Parameters:
parentDom- the parent elementdigestAlgorithm- the digest algorithm xml identifier
-
incorporateDigestValue
protected void incorporateDigestValue(Element parentDom, DigestAlgorithm digestAlgorithm, DSSDocument originalDocument)This method creates the ds:DigestValue DOM object.<ds:DigestValue>fj8SJujSXU4fi342bdtiKVbglA0=</ds:DigestValue>- Parameters:
parentDom- the parent elementdigestAlgorithm- the digest algorithm to be usedoriginalDocument- the document to be digested
-
incorporateDigestValue
protected void incorporateDigestValue(Element parentDom, DigestAlgorithm digestAlgorithm, Token token)This method creates the ds:DigestValue DOM object.<ds:DigestValue>fj8SJujSXU4fi342bdtiKVbglA0=</ds:DigestValue>- Parameters:
parentDom- the parent elementdigestAlgorithm- the digest algorithm to usetoken- the token to be digested
-
incorporateCertificateRef
protected void incorporateCertificateRef(Element signingCertificateDom, Set<CertificateToken> certificates)Incorporates the certificate's references as a child of the given parent node. The first element of theX509CertificateListMUST be the signing certificate.- Parameters:
signingCertificateDom- DOM parent elementcertificates-Listof the certificates to be incorporated
-
incorporateCert
Creates Cert DOM object:<Cert> <CertDigest> <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> <ds:DigestValue>fj8SJujSXU4fi342bdtiKVbglA0=</ds:DigestValue> </CertDigest> <IssuerSerial> <ds:X509IssuerName>CN=ICA A,O=DSS,C=AA</ds:X509IssuerName> <ds:X509SerialNumber>4</ds:X509SerialNumber> </IssuerSerial> </Cert>- Parameters:
parentDom- the parent elementcertificate- the certificate to be added- Returns:
Element
-
incorporateIssuerV1
Incorporates IssuerSerial element- Parameters:
parentDom-Elementcertificate-CertificateTokento get issuer for
-
incorporateIssuerV2
Incorporates IssuerSerialV2 element- Parameters:
parentDom-Elementcertificate-CertificateTokento get issuer for
-
getReferenceDigestAlgorithmOrDefault
Returns params.referenceDigestAlgorithm if exists, params.digestAlgorithm otherwise- Parameters:
params-XAdESSignatureParameters- Returns:
DigestAlgorithm
-
createXmlDocument
CreatesDSSDocumentfrom the current documentDom- Returns:
DSSDocument
-
alignNodes
protected abstract void alignNodes() -
getXmldsigNamespace
This method returns the current used XMLDSig namespace- Returns:
DSSNamespace
-
getXadesNamespace
This method returns the current used XAdES namespace- Returns:
DSSNamespace
-
getXades141Namespace
This method returns the current used XAdES 1.4.1 namespace- Returns:
DSSNamespace
-
getCurrentXAdESElements
Gets a relevant class containing the list of elements- Returns:
XAdESElementimplementation
-
getCurrentXAdESPaths
Gets a relevant class containing the list of paths- Returns:
XAdESPathsimplementation
-