当前位置: 首页>>代码示例>>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;未经允许,请勿转载。