es.gob.afirma.core.misc.Base64.encode()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中es.gob.afirma.core.misc.Base64.encode()方法的一些代码示例,展示了Base64.encode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Base64.encode()方法的具体详情如下:
包路径:es.gob.afirma.core.misc.Base64
类名称:Base64
方法名:encode

Base64.encode介绍

[英]Codifica un binario en Base64.
[中]编纂联合国二进制代码64。

代码示例

代码示例来源:origin: es.gob.afirma/afirma-keystores-filters

/** {@inheritDoc} */
  @Override
  public boolean matches(final X509Certificate cert) {
    try {
      return this.certEncoded.equals(Base64.encode(cert.getEncoded()));
    } catch (final CertificateEncodingException e) {
      Logger.getLogger("es.gob.afirma").warning( //$NON-NLS-1$
          "No se ha podido codificar el certificado en base 64. Se ignorara: " + e  //$NON-NLS-1$
        );
      return false;
    }
  }
}

代码示例来源:origin: es.gob.afirma/afirma-crypto-batch-client

private static String getCertChainAsBase64(final Certificate[] certChain) throws CertificateEncodingException {
  final StringBuilder sb = new StringBuilder();
  for (final Certificate cert : certChain) {
    sb.append(Base64.encode(cert.getEncoded(), true));
    sb.append(";"); //$NON-NLS-1$
  }
  final String ret = sb.toString();
  // Quitamos el ";" final
  return ret.substring(0, ret.length()-1);
}

代码示例来源:origin: es.gob.afirma/afirma-core

/** Convierte un objeto de propiedades en una cadena Base64 URL SAFE.
 * @param p Objeto de propiedades a convertir.
 * @return Base64 URL SAFE que descodificado es un fichero de propiedades en texto plano.
 * @throws IOException Si hay problemas en la conversión a Base64. */
public static String properties2Base64(final Properties p) throws IOException {
  if (p == null) {
    return ""; //$NON-NLS-1$
  }
  final ByteArrayOutputStream baos = new ByteArrayOutputStream();
  final OutputStreamWriter osw = new OutputStreamWriter(baos, DEFAULT_ENCODING);
  p.store(osw, ""); //$NON-NLS-1$
  return Base64.encode(baos.toByteArray(), true);
}

代码示例来源:origin: es.gob.afirma/afirma-core

/** Compone un texto con los certificados de la cadena indicada codificados en Base64 de tipo <i>URL-Safe</i> concatenados
 * usando el separador por defecto.
 * @param certChain Cadena de certificados.
 * @param extraParams Par&aacute;metros adicionales de la firma, para comprobar si hay que incluir la cadena
 *                     completa de certificados o solo el certificado del firmante.
 * @return Texto con los certificados de la cadena codificados en Base64 de tipo <i>URL-Safe</i> y concatenados
 *         usando el separador por defecto.
 * @throws CertificateEncodingException Si hay problemas obteniendo la codificaci&oacute;n de alg&uacute;n certificado. */
public static String prepareCertChainParam(final Certificate[] certChain, final Properties extraParams) throws CertificateEncodingException {
  if (certChain == null || certChain.length < 1) {
    throw new IllegalArgumentException(
      "La cadena de certificados no puede ser nula ni vacia" //$NON-NLS-1$
    );
  }
  if (extraParams == null || Boolean.parseBoolean(extraParams.getProperty(INCLUDE_ONLY_SIGNNING_CERTIFICATE, Boolean.FALSE.toString()))) {
    return Base64.encode(certChain[0].getEncoded(), true);
  }
  final StringBuilder sb = new StringBuilder();
  for (final Certificate cert : certChain) {
    sb.append(Base64.encode(cert.getEncoded(), true));
    sb.append(PARAM_NAME_CERT_SEPARATOR);
  }
  final String ret = sb.toString();
  return ret.substring(0, ret.length() - PARAM_NAME_CERT_SEPARATOR.length());
}

代码示例来源:origin: es.gob.afirma/afirma-crypto-pdf

.append(" </pdfIf>\n") //$NON-NLS-1$
.append(" <sign>\n") //$NON-NLS-1$
.append(Base64.encode(getSign())).append('\n')
.append(" </sign>\n") //$NON-NLS-1$
.append(" <timestamp>\n") //$NON-NLS-1$
.append(this.timestamp != null ? Base64.encode(getTimestamp()) : "").append('\n') //$NON-NLS-1$
.append(" </timestamp>\n") //$NON-NLS-1$
.append(" <signTime>\n") //$NON-NLS-1$

代码示例来源:origin: es.gob.afirma/afirma-core

this.policyIdentifierHash =  Base64.encode(
    MessageDigest.getInstance(this.policyIdentifierHashAlgorithm).digest(
        AOUtil.getDataFromInputStream(new URL(identifier).openStream())));

代码示例来源:origin: es.gob.afirma/afirma-core-massive

signsB64[i] = Base64.encode(signs[i]);

代码示例来源:origin: es.gob.afirma/afirma-core

final String documentId = Base64.encode(data, true);
  cerChainParamContent = Base64.encode(certChain[0].getEncoded(), true);
  throw new AOException("Error al decodificar la prefirma de los datos", e); //$NON-NLS-1$
tri.addProperty(PROPERTY_NAME_PKCS1_SIGN, Base64.encode(pkcs1));
final String preResultAsBase64 = Base64.encode(
  triphaseData.toString().getBytes(),
  true

代码示例来源:origin: es.gob.afirma/afirma-core-firmaweb

bos.write(Base64.encode(baos.toByteArray()).getBytes());
bos.flush();

代码示例来源:origin: es.gob.afirma/afirma-core

tmpStr = un.getPassword();
authString = Base64.encode(tmpStr.getBytes());
url = un.getProtocol() +
  PROT_SEPARATOR +

代码示例来源:origin: es.gob.afirma/afirma-crypto-cadestri-client

final String documentId = Base64.encode(docId, true);
final String preResultAsBase64 = Base64.encode(TriphaseDataSigner.doSign(
  new AOPkcs1Signer(),
  algorithm,

代码示例来源:origin: es.gob.afirma/afirma-crypto-batch-client

BATCH_XML_PARAM + EQU + batchUrlSafe + AMP +
    BATCH_CRT_PARAM + EQU + getCertChainAsBase64(certificates) + AMP +
    BATCH_TRI_PARAM + EQU + Base64.encode(td2.toString().getBytes(), true),
    UrlHttpMethod.POST
);

代码示例来源:origin: es.gob.afirma/afirma-crypto-xmlsignature

dataElement.setTextContent(Base64.encode(data));
      wasEncodedToBase64 = true;
dataElement.setAttributeNS(null, ENCODING_STR, encoding);
dataElement.setTextContent(Base64.encode(digestValue));
isBase64 = true;

代码示例来源:origin: es.gob.afirma/afirma-core

signConfig.addProperty(PROPERTY_NAME_PKCS1_SIGN, Base64.encode(pkcs1sign));

相关文章