當前位置: 首頁>>代碼示例>>Java>>正文


Java CertificateEncodingException.getMessage方法代碼示例

本文整理匯總了Java中java.security.cert.CertificateEncodingException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java CertificateEncodingException.getMessage方法的具體用法?Java CertificateEncodingException.getMessage怎麽用?Java CertificateEncodingException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.security.cert.CertificateEncodingException的用法示例。


在下文中一共展示了CertificateEncodingException.getMessage方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addKeyAgreementRecipients

import java.security.cert.CertificateEncodingException; //導入方法依賴的package包/類
/**
 * Add multiple key agreement based recipients (sharing a single KeyAgreeRecipientInfo structure).
 *
 * @deprecated use the addRecipientGenerator and JceKeyAgreeRecipientInfoGenerator
 * @param agreementAlgorithm key agreement algorithm to use.
 * @param senderPrivateKey private key to initialise sender side of agreement with.
 * @param senderPublicKey sender public key to include with message.
 * @param recipientCerts recipients' public key certificates.
 * @param cekWrapAlgorithm OID for key wrapping algorithm to use.
 * @param provider provider to use for the agreement calculation.
 * @exception NoSuchAlgorithmException if the algorithm requested cannot be found
 * @exception InvalidKeyException if the keys are inappropriate for the algorithm specified
 */
public void addKeyAgreementRecipients(
    String           agreementAlgorithm,
    PrivateKey       senderPrivateKey,
    PublicKey        senderPublicKey,
    Collection       recipientCerts,
    String           cekWrapAlgorithm,
    Provider         provider)
    throws NoSuchAlgorithmException, InvalidKeyException
{
    JceKeyAgreeRecipientInfoGenerator recipientInfoGenerator = new JceKeyAgreeRecipientInfoGenerator(new ASN1ObjectIdentifier(agreementAlgorithm), senderPrivateKey, senderPublicKey, new ASN1ObjectIdentifier(cekWrapAlgorithm)).setProvider(provider);

    for (Iterator it = recipientCerts.iterator(); it.hasNext();)
    {
        try
        {
            recipientInfoGenerator.addRecipient((X509Certificate)it.next());
        }
        catch (CertificateEncodingException e)
        {
            throw new IllegalArgumentException("unable to encode certificate: " + e.getMessage());
        }
    }

    oldRecipientInfoGenerators.add(recipientInfoGenerator);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:39,代碼來源:CMSEnvelopedGenerator.java

示例2: writeCertArray

import java.security.cert.CertificateEncodingException; //導入方法依賴的package包/類
private void writeCertArray(Writer writer, Certificate[] certificates) throws IOException {
  if (certificates == null) {
    writer.write("-1\n");
    return;
  }
  try {
    writer.write(Integer.toString(certificates.length) + '\n');
    for (Certificate certificate : certificates) {
      byte[] bytes = certificate.getEncoded();
      String line = Base64.encode(bytes);
      writer.write(line + '\n');
    }
  } catch (CertificateEncodingException e) {
    throw new IOException(e.getMessage());
  }
}
 
開發者ID:aabognah,項目名稱:LoRaWAN-Smart-Parking,代碼行數:17,代碼來源:HttpResponseCache.java

示例3: writeCertList

import java.security.cert.CertificateEncodingException; //導入方法依賴的package包/類
private void writeCertList(BufferedSink sink, List<Certificate> certificates)
    throws IOException {
  try {
    sink.writeDecimalLong(certificates.size())
        .writeByte('\n');
    for (int i = 0, size = certificates.size(); i < size; i++) {
      byte[] bytes = certificates.get(i).getEncoded();
      String line = ByteString.of(bytes).base64();
      sink.writeUtf8(line)
          .writeByte('\n');
    }
  } catch (CertificateEncodingException e) {
    throw new IOException(e.getMessage());
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:Cache.java

示例4: convertCert

import java.security.cert.CertificateEncodingException; //導入方法依賴的package包/類
private static Certificate convertCert(X509Certificate certificate)
    throws IOException
{
    try
    {
        return Certificate.getInstance(certificate.getEncoded());
    }
    catch (CertificateEncodingException e)
    {
        throw new PKCSIOException("cannot encode certificate: " + e.getMessage(), e);
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:13,代碼來源:JcaPKCS12SafeBagBuilder.java

示例5: addKeyTransRecipient

import java.security.cert.CertificateEncodingException; //導入方法依賴的package包/類
/**
 * add a recipient.
 *
 * @deprecated use the addRecipientGenerator and JceKeyTransRecipientInfoGenerator
 * @param cert recipient's public key certificate
 * @exception IllegalArgumentException if there is a problem with the certificate
 */
public void addKeyTransRecipient(
    X509Certificate cert)
    throws IllegalArgumentException
{
    try
    {
        oldRecipientInfoGenerators.add(new JceKeyTransRecipientInfoGenerator(cert));
    }
    catch (CertificateEncodingException e)
    {
        throw new IllegalArgumentException("unable to encode certificate: " + e.getMessage());
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:21,代碼來源:CMSEnvelopedGenerator.java

示例6: Asn1EntityIdAndCert

import java.security.cert.CertificateEncodingException; //導入方法依賴的package包/類
public Asn1EntityIdAndCert(P11EntityIdentifier entityId, X509Certificate certificate) {
    ParamUtil.requireNonNull("entityId", entityId);
    ParamUtil.requireNonNull("certificate", certificate);
    this.entityId = new Asn1P11EntityIdentifier(entityId);
    byte[] encoded;
    try {
        encoded = certificate.getEncoded();
    } catch (CertificateEncodingException ex) {
        throw new IllegalArgumentException("could not encode certificate: " + ex.getMessage(),
                ex);
    }
    this.certificate = Certificate.getInstance(encoded);
}
 
開發者ID:xipki,項目名稱:xitk,代碼行數:14,代碼來源:Asn1EntityIdAndCert.java


注:本文中的java.security.cert.CertificateEncodingException.getMessage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。