本文整理匯總了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);
}
示例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());
}
}
示例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());
}
}
示例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);
}
}
示例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());
}
}
示例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);
}