DomUtils.addElement
Code IndexAdd Codota to your IDE (free)

Best code snippets using eu.europa.esig.dss.DomUtils.addElement(Showing top 15 results out of 315)

origin: esig/dss

private void incorporateSigningCertificateV1(Set<CertificateToken> certificates) {
  Element signingCertificateDom = DomUtils.addElement(documentDom, signedSignaturePropertiesDom, XAdES, XAdESNamespaces.getXADES_SIGNING_CERTIFICATE());
  for (final CertificateToken certificate : certificates) {
    final Element certDom = incorporateCert(signingCertificateDom, certificate);
    incorporateIssuerV1(certDom, certificate);
  }
}
origin: esig/dss

protected void incorporateIssuerV2(final Element parentDom, final CertificateToken certificate) {
  final Element issuerSerialDom = DomUtils.addElement(documentDom, parentDom, XAdES, XADES_ISSUER_SERIAL_V2);
  IssuerSerial issuerSerial = DSSASN1Utils.getIssuerSerial(certificate);
  String issuerBase64 = Utils.toBase64(DSSASN1Utils.getDEREncoded(issuerSerial));
  DomUtils.setTextNode(documentDom, issuerSerialDom, issuerBase64);
}
origin: esig/dss

private void incorporateOcspTokens(Element parentDom, final List<OCSPToken> ocspTokens) {
  if (ocspTokens.isEmpty()) {
    return;
  }
  // ...<xades:OCSPValues>
  // .........<xades:EncapsulatedOCSPValue>MIIERw...
  final Element ocspValuesDom = DomUtils.addElement(documentDom, parentDom, XAdESNamespaces.XAdES, "xades:OCSPValues");
  for (final RevocationToken revocationToken : ocspTokens) {
    final byte[] encodedOCSP = revocationToken.getEncoded();
    final String base64EncodedOCSP = Utils.toBase64(encodedOCSP);
    DomUtils.addTextElement(documentDom, ocspValuesDom, XAdESNamespaces.XAdES, "xades:EncapsulatedOCSPValue", base64EncodedOCSP);
  }
}
origin: esig/dss

public void incorporateSignedInfo() {
  // <ds:SignedInfo>
  signedInfoDom = DomUtils.addElement(documentDom, signatureDom, XMLNS, DS_SIGNED_INFO);
  incorporateCanonicalizationMethod(signedInfoDom, signedInfoCanonicalizationMethod);
  // <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
  final Element signatureMethod = DomUtils.addElement(documentDom, signedInfoDom, XMLNS, DS_SIGNATURE_METHOD);
  final EncryptionAlgorithm encryptionAlgorithm = params.getEncryptionAlgorithm();
  final DigestAlgorithm digestAlgorithm = params.getDigestAlgorithm();
  final MaskGenerationFunction mgf = params.getMaskGenerationFunction();
  final SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.getAlgorithm(encryptionAlgorithm, digestAlgorithm, mgf);
  final String signatureAlgorithmXMLId = signatureAlgorithm.getXMLId();
  signatureMethod.setAttribute(ALGORITHM, signatureAlgorithmXMLId);
}
origin: esig/dss

protected void addSigReference(final Document documentDom, final Element asicManifestDom, String uri, MimeType mimeType) {
  final Element sigReferenceDom = DomUtils.addElement(documentDom, asicManifestDom, ASiCNamespace.NS, ASiCNamespace.SIG_REFERENCE);
  sigReferenceDom.setAttribute("URI", uri);
  sigReferenceDom.setAttribute("MimeType", mimeType.getMimeTypeString());
}
origin: esig/dss

/**
 * Creates the SignedProperties DOM object element.
 *
 * @throws DSSException
 */
protected void incorporateSignedProperties() throws DSSException {
  // <SignedProperties Id="xades-ide5c549340079fe19f3f90f03354a5965">
  signedPropertiesDom = DomUtils.addElement(documentDom, qualifyingPropertiesDom, XAdES, XADES_SIGNED_PROPERTIES);
  signedPropertiesDom.setAttribute(ID, "xades-" + deterministicId);
  incorporateSignedSignatureProperties();
}
origin: esig/dss

private void incorporateCrlTokens(final Element parentDom, final List<CRLToken> crlTokens) {
  if (crlTokens.isEmpty()) {
    return;
  }
  // ...<xades:CRLValues/>
  final Element crlValuesDom = DomUtils.addElement(documentDom, parentDom, XAdESNamespaces.XAdES, "xades:CRLValues");
  for (final RevocationToken revocationToken : crlTokens) {
    final byte[] encodedCRL = revocationToken.getEncoded();
    final String base64EncodedCRL = Utils.toBase64(encodedCRL);
    DomUtils.addTextElement(documentDom, crlValuesDom, XAdESNamespaces.XAdES, "xades:EncapsulatedCRLValue", base64EncodedCRL);
  }
}
origin: esig/dss

private void addRoles(final List<String> signerRoles, final Element rolesDom, final String roleType) {
  for (final String signerRole : signerRoles) {
    final Element roleDom = DomUtils.addElement(documentDom, rolesDom, XAdES, roleType);
    DomUtils.setTextNode(documentDom, roleDom, signerRole);
  }
}
origin: esig/dss

protected void incorporateIssuerV1(final Element parentDom, final CertificateToken certificate) {
  final Element issuerSerialDom = DomUtils.addElement(documentDom, parentDom, XAdES, XADES_ISSUER_SERIAL);
  final Element x509IssuerNameDom = DomUtils.addElement(documentDom, issuerSerialDom, XMLNS, DS_X509_ISSUER_NAME);
  final String issuerX500PrincipalName = certificate.getIssuerX500Principal().getName();
  DomUtils.setTextNode(documentDom, x509IssuerNameDom, issuerX500PrincipalName);
  final Element x509SerialNumberDom = DomUtils.addElement(documentDom, issuerSerialDom, XMLNS, DS_X509_SERIAL_NUMBER);
  final BigInteger serialNumber = certificate.getSerialNumber();
  final String serialNumberString = new String(serialNumber.toString());
  DomUtils.setTextNode(documentDom, x509SerialNumberDom, serialNumberString);
}
origin: esig/dss

private void incorporateSigningCertificateV2(Set<CertificateToken> certificates) {
  Element signingCertificateDom = DomUtils.addElement(documentDom, signedSignaturePropertiesDom, XAdES,
      XAdESNamespaces.getXADES_SIGNING_CERTIFICATE_V2());
  for (final CertificateToken certificate : certificates) {
    final Element certDom = incorporateCert(signingCertificateDom, certificate);
    incorporateIssuerV2(certDom, certificate);
  }
}
origin: esig/dss

protected Element incorporateCert(final Element parentDom, final CertificateToken certificate) {
  final Element certDom = DomUtils.addElement(documentDom, parentDom, XAdES, XADES_CERT);
  final Element certDigestDom = DomUtils.addElement(documentDom, certDom, XAdES, XADES_CERT_DIGEST);
  final DigestAlgorithm signingCertificateDigestMethod = params.getSigningCertificateDigestMethod();
  incorporateDigestMethod(certDigestDom, signingCertificateDigestMethod);
  incorporateDigestValue(certDigestDom, signingCertificateDigestMethod, certificate);
  return certDom;
}
origin: esig/dss

/**
 * @throws DSSException
 */
protected void incorporateObject() throws DSSException {
  // <ds:Object>
  final Element objectDom = DomUtils.addElement(documentDom, signatureDom, XMLNS, DS_OBJECT);
  // <QualifyingProperties xmlns="http://uri.etsi.org/01903/v1.3.2#"
  // Target="#sigId-ide5c549340079fe19f3f90f03354a5965">
  qualifyingPropertiesDom = DomUtils.addElement(documentDom, objectDom, XAdES, XADES_QUALIFYING_PROPERTIES);
  qualifyingPropertiesDom.setAttribute(XMLNS_XADES, XAdES);
  qualifyingPropertiesDom.setAttribute(TARGET, "#" + deterministicId);
  incorporateSignedProperties();
}
origin: esig/dss

private void incorporateCanonicalizationMethod(final Element parentDom, final String signedInfoCanonicalizationMethod) {
  // <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
  final Element canonicalizationMethodDom = DomUtils.addElement(documentDom, parentDom, XMLNS, DS_CANONICALIZATION_METHOD);
  canonicalizationMethodDom.setAttribute(ALGORITHM, signedInfoCanonicalizationMethod);
}
origin: esig/dss

/**
 * This method incorporates the signature value.
 */
protected void incorporateSignatureValue() {
  signatureValueDom = DomUtils.addElement(documentDom, signatureDom, XMLNS, DS_SIGNATURE_VALUE);
  signatureValueDom.setAttribute(ID, "value-" + deterministicId);
}
origin: esig/dss

private void incorporateCrlTokens(final Element parentDom, final List<CRLToken> crlTokens) {
  if (crlTokens.isEmpty()) {
    return;
  }
  // ...<xades:CRLValues/>
  final Element crlValuesDom = DomUtils.addElement(documentDom, parentDom, XAdESNamespaces.XAdES, "xades:CRLValues");
  for (final RevocationToken revocationToken : crlTokens) {
    final byte[] encodedCRL = revocationToken.getEncoded();
    final String base64EncodedCRL = Utils.toBase64(encodedCRL);
    DomUtils.addTextElement(documentDom, crlValuesDom, XAdESNamespaces.XAdES, "xades:EncapsulatedCRLValue", base64EncodedCRL);
  }
}
eu.europa.esig.dssDomUtilsaddElement

Javadoc

This method creates and adds a new XML Element

Popular methods of DomUtils

  • buildDOM
    This method returns the org.w3c.dom.Document created based on byte array.
  • getNodeList
    Returns the NodeList corresponding to the XPath query.
  • createDssDocumentFromDomDocument
  • getElement
    Return the Element corresponding to the XPath query.
  • getNode
    Return the Node corresponding to the XPath query.
  • getSecureTransformer
  • getValue
    Returns the String value of the corresponding to the XPath query.
  • addTextElement
    This method creates and adds a new XML Element with text value
  • createDocument
    Creates a DOM document without document element.
  • createXMLGregorianCalendar
    Converts a given Date to a new XMLGregorianCalendar.
  • createXPathExpression
  • ensureDocumentBuilder
    Guarantees that the xmlString builder has been created.
  • createXPathExpression,
  • ensureDocumentBuilder,
  • getChildrenNames,
  • getDate,
  • getSecureTransformerFactory,
  • isNotEmpty,
  • registerNamespace,
  • setTextNode,
  • writeDocumentTo

Popular classes and methods

  • getContentResolver (Context)
  • runOnUiThread (Activity)
  • setScale (BigDecimal)
    Returns a new BigDecimal instance with the specified scale. If the new scale is greater than the old
  • ObjectMapper (com.fasterxml.jackson.databind)
    This mapper (or, data binder, or codec) provides functionality for converting between Java objects (
  • Graphics2D (java.awt)
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • SortedMap (java.util)
    A Map that further provides a total ordering on its keys. The map is ordered according to the Compar
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)