Esempio n. 1
0
  private void incorporateCrlTokens(final Element parentDom, final List<CRLToken> crlTokens) {

    if (crlTokens.isEmpty()) {

      return;
    }
    // ...<xades:CRLValues/>
    final Element crlValuesDom =
        DSSXMLUtils.addElement(documentDom, parentDom, XAdESNamespaces.XAdES, "xades:CRLValues");

    for (final RevocationToken revocationToken : crlTokens) {

      final byte[] encodedCRL = revocationToken.getEncoded();
      final String base64EncodedCRL = Base64.encodeBase64String(encodedCRL);
      DSSXMLUtils.addTextElement(
          documentDom,
          crlValuesDom,
          XAdESNamespaces.XAdES,
          "xades:EncapsulatedCRLValue",
          base64EncodedCRL);
    }
  }
Esempio n. 2
0
  private void incorporateOcspTokens(Element parentDom, final List<OCSPToken> ocspTokens) {

    if (ocspTokens.isEmpty()) {

      return;
    }

    // ...<xades:OCSPValues>
    // .........<xades:EncapsulatedOCSPValue>MIIERw...
    final Element ocspValuesDom =
        DSSXMLUtils.addElement(documentDom, parentDom, XAdESNamespaces.XAdES, "xades:OCSPValues");

    for (final RevocationToken revocationToken : ocspTokens) {

      final byte[] encodedOCSP = revocationToken.getEncoded();
      final String base64EncodedOCSP = Base64.encodeBase64String(encodedOCSP);
      DSSXMLUtils.addTextElement(
          documentDom,
          ocspValuesDom,
          XAdESNamespaces.XAdES,
          "xades:EncapsulatedOCSPValue",
          base64EncodedOCSP);
    }
  }