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


Java X509CertificateHolder.toASN1Structure方法代碼示例

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


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

示例1: match

import org.bouncycastle.cert.X509CertificateHolder; //導入方法依賴的package包/類
public boolean match(Object obj)
{
    if (obj instanceof X509CertificateHolder)
    {
        X509CertificateHolder certHldr = (X509CertificateHolder)obj;

        if (this.getSerialNumber() != null)
        {
            IssuerAndSerialNumber iAndS = new IssuerAndSerialNumber(certHldr.toASN1Structure());

            return iAndS.getName().equals(this.issuer)
                && iAndS.getSerialNumber().getValue().equals(this.serialNumber);
        }
        else if (subjectKeyId != null)
        {
            Extension ext = certHldr.getExtension(Extension.subjectKeyIdentifier);

            if (ext == null)
            {
                return Arrays.areEqual(subjectKeyId, MSOutlookKeyIdCalculator.calculateKeyId(certHldr.getSubjectPublicKeyInfo()));
            }

            byte[] subKeyID = ASN1OctetString.getInstance(ext.getParsedValue()).getOctets();

            return Arrays.areEqual(subjectKeyId, subKeyID);
        }
    }
    else if (obj instanceof byte[])
    {
        return Arrays.areEqual(subjectKeyId, (byte[])obj);
    }

    return false;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:35,代碼來源:X509CertificateHolderSelector.java

示例2: build

import org.bouncycastle.cert.X509CertificateHolder; //導入方法依賴的package包/類
/**
 * Build a generator with the passed in certHolder issuer and serial number as the signerIdentifier.
 *
 * @param contentSigner  operator for generating the final signature in the SignerInfo with.
 * @param certHolder  carrier for the X.509 certificate related to the contentSigner.
 * @return  a SignerInfoGenerator
 * @throws OperatorCreationException   if the generator cannot be built.
 */
public SignerInfoGenerator build(ContentSigner contentSigner, X509CertificateHolder certHolder)
    throws OperatorCreationException
{
    SignerIdentifier sigId = new SignerIdentifier(new IssuerAndSerialNumber(certHolder.toASN1Structure()));

    SignerInfoGenerator sigInfoGen = createGenerator(contentSigner, sigId);

    sigInfoGen.setAssociatedCertificate(certHolder);

    return sigInfoGen;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:20,代碼來源:SignerInfoGeneratorBuilder.java

示例3: generateCert

import org.bouncycastle.cert.X509CertificateHolder; //導入方法依賴的package包/類
private X509CertificateObject generateCert(String keyName, KeyPair kp, boolean isCertAuthority,
    PublicKey signerPublicKey, PrivateKey signerPrivateKey) throws IOException,
    CertIOException, OperatorCreationException, CertificateException,
    NoSuchAlgorithmException {
  Calendar startDate = DateTimeUtils.calendar();
  Calendar endDate = DateTimeUtils.calendar();
  endDate.add(Calendar.YEAR, 100);

  BigInteger serialNumber = BigInteger.valueOf(startDate.getTimeInMillis());
  X500Name issuer = new X500Name(
      IETFUtils.rDNsFromString("cn=localhost", RFC4519Style.INSTANCE));
  JcaX509v3CertificateBuilder certGen = new JcaX509v3CertificateBuilder(issuer,
      serialNumber, startDate.getTime(), endDate.getTime(), issuer, kp.getPublic());
  JcaX509ExtensionUtils extensionUtils = new JcaX509ExtensionUtils();
  certGen.addExtension(Extension.subjectKeyIdentifier, false,
      extensionUtils.createSubjectKeyIdentifier(kp.getPublic()));
  certGen.addExtension(Extension.basicConstraints, false,
      new BasicConstraints(isCertAuthority));
  certGen.addExtension(Extension.authorityKeyIdentifier, false,
      extensionUtils.createAuthorityKeyIdentifier(signerPublicKey));
  if (isCertAuthority) {
    certGen.addExtension(Extension.keyUsage, true, new KeyUsage(KeyUsage.keyCertSign));
  }
  X509CertificateHolder cert = certGen.build(
      new JcaContentSignerBuilder(SIGNING_ALGORITHM).build(signerPrivateKey));
  return new X509CertificateObject(cert.toASN1Structure());
}
 
開發者ID:apache,項目名稱:calcite-avatica,代碼行數:28,代碼來源:SslDriverTest.java

示例4: PKCS12SafeBagBuilder

import org.bouncycastle.cert.X509CertificateHolder; //導入方法依賴的package包/類
public PKCS12SafeBagBuilder(X509CertificateHolder certificate)
    throws IOException
{
    this(certificate.toASN1Structure());
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:6,代碼來源:PKCS12SafeBagBuilder.java

示例5: BcKeyTransRecipientInfoGenerator

import org.bouncycastle.cert.X509CertificateHolder; //導入方法依賴的package包/類
public BcKeyTransRecipientInfoGenerator(X509CertificateHolder recipientCert, BcAsymmetricKeyWrapper wrapper)
{
    super(new IssuerAndSerialNumber(recipientCert.toASN1Structure()), wrapper);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:5,代碼來源:BcKeyTransRecipientInfoGenerator.java

示例6: toJava

import org.bouncycastle.cert.X509CertificateHolder; //導入方法依賴的package包/類
private static Certificate toJava(X509CertificateHolder certHolder) throws Exception {
    return new X509CertificateObject(certHolder.toASN1Structure());
}
 
開發者ID:codeabovelab,項目名稱:haven-platform,代碼行數:4,代碼來源:CertificateGenerator.java


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