当前位置: 首页>>代码示例>>Java>>正文


Java Certificate类代码示例

本文整理汇总了Java中org.bouncycastle.asn1.x509.Certificate的典型用法代码示例。如果您正苦于以下问题:Java Certificate类的具体用法?Java Certificate怎么用?Java Certificate使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Certificate类属于org.bouncycastle.asn1.x509包,在下文中一共展示了Certificate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateJcaObject

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
private X509Certificate generateJcaObject(TBSCertificate tbsCert, byte[] signature)
    throws CertificateEncodingException
{
    ASN1EncodableVector v = new ASN1EncodableVector();

    v.add(tbsCert);
    v.add(sigAlgId);
    v.add(new DERBitString(signature));

    try
    {
        return new X509CertificateObject(Certificate.getInstance(new DERSequence(v)));
    }
    catch (CertificateParsingException e)
    {
        throw new ExtCertificateEncodingException("exception producing certificate object", e);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:19,代码来源:X509V1CertificateGenerator.java

示例2: copyAndAddExtension

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
/**
 * Add a given extension field for the standard extensions tag (tag 3)
 * copying the extension value from another certificate.
 *
 * @param oid the OID defining the extension type.
 * @param isCritical true if the copied extension is to be marked as critical, false otherwise.
 * @param certHolder the holder for the certificate that the extension is to be copied from.
 * @return this builder object.
 */
public X509v3CertificateBuilder copyAndAddExtension(
    ASN1ObjectIdentifier oid,
    boolean isCritical,
    X509CertificateHolder certHolder)
{
    Certificate cert = certHolder.toASN1Structure();

    Extension extension = cert.getTBSCertificate().getExtensions().getExtension(oid);

    if (extension == null)
    {
        throw new NullPointerException("extension " + oid + " not present");
    }

    extGenerator.addExtension(oid, isCritical, extension.getExtnValue().getOctets());

    return this;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:28,代码来源:X509v3CertificateBuilder.java

示例3: CscaMasterList

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
private CscaMasterList(
    ASN1Sequence seq)
{
    if (seq == null || seq.size() == 0)
    {
        throw new IllegalArgumentException(
            "null or empty sequence passed.");
    }
    if (seq.size() != 2)
    {
        throw new IllegalArgumentException(
            "Incorrect sequence size: " + seq.size());
    }

    version = ASN1Integer.getInstance(seq.getObjectAt(0));
    ASN1Set certSet = ASN1Set.getInstance(seq.getObjectAt(1));
    certList = new Certificate[certSet.size()];
    for (int i = 0; i < certList.length; i++)
    {
        certList[i]
            = Certificate.getInstance(certSet.getObjectAt(i));
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:CscaMasterList.java

示例4: getInstance

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
public static RequestedCertificate getInstance(Object obj)
{
    if (obj == null || obj instanceof RequestedCertificate)
    {
        return (RequestedCertificate)obj;
    }

    if (obj instanceof ASN1Sequence)
    {
        return new RequestedCertificate(Certificate.getInstance(obj));
    }
    if (obj instanceof ASN1TaggedObject)
    {
        return new RequestedCertificate((ASN1TaggedObject)obj);
    }

    throw new IllegalArgumentException("illegal object in getInstance: "
        + obj.getClass().getName());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:RequestedCertificate.java

示例5: getInstance

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
public static CMPCertificate getInstance(Object o)
{
    if (o == null || o instanceof CMPCertificate)
    {
        return (CMPCertificate)o;
    }

    if (o instanceof ASN1Sequence || o instanceof byte[])
    {
        return new CMPCertificate(Certificate.getInstance(o));
    }

    if (o instanceof ASN1TaggedObject)
    {
        return new CMPCertificate(AttributeCertificate.getInstance(((ASN1TaggedObject)o).getObject()));
    }

    throw new IllegalArgumentException("Invalid object: " + o.getClass().getName());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:CMPCertificate.java

示例6: readDERCertificate

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
private java.security.cert.Certificate readDERCertificate(
    ASN1InputStream dIn)
    throws IOException, CertificateParsingException
{
    ASN1Sequence seq = (ASN1Sequence)dIn.readObject();

    if (seq.size() > 1
            && seq.getObjectAt(0) instanceof ASN1ObjectIdentifier)
    {
        if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
        {
            sData = SignedData.getInstance(ASN1Sequence.getInstance(
                (ASN1TaggedObject)seq.getObjectAt(1), true)).getCertificates();

            return getCertificate();
        }
    }

    return new X509CertificateObject(
                        Certificate.getInstance(seq));
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:CertificateFactory.java

示例7: getCertificate

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
private java.security.cert.Certificate getCertificate()
    throws CertificateParsingException
{
    if (sData != null)
    {
        while (sDataObjectCount < sData.size())
        {
            Object obj = sData.getObjectAt(sDataObjectCount++);

            if (obj instanceof ASN1Sequence)
            {
               return new X509CertificateObject(
                                Certificate.getInstance(obj));
            }
        }
    }

    return null;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:20,代码来源:CertificateFactory.java

示例8: getCertificates

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
Store getCertificates(ASN1Set certSet)
{
    if (certSet != null)
    {
        List certList = new ArrayList(certSet.size());

        for (Enumeration en = certSet.getObjects(); en.hasMoreElements();)
        {
            ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();

            if (obj instanceof ASN1Sequence)
            {
                certList.add(new X509CertificateHolder(Certificate.getInstance(obj)));
            }
        }

        return new CollectionStore(certList);
    }

    return new CollectionStore(new ArrayList());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:CMSSignedHelper.java

示例9: getCertificates

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
/**
 * Return the certificates stored in the underlying OriginatorInfo object.
 *
 * @return a Store of X509CertificateHolder objects.
 */
public Store getCertificates()
{
    ASN1Set certSet = originatorInfo.getCertificates();

    if (certSet != null)
    {
        List certList = new ArrayList(certSet.size());

        for (Enumeration en = certSet.getObjects(); en.hasMoreElements();)
        {
            ASN1Primitive obj = ((ASN1Encodable)en.nextElement()).toASN1Primitive();

            if (obj instanceof ASN1Sequence)
            {
                certList.add(new X509CertificateHolder(Certificate.getInstance(obj)));
            }
        }

        return new CollectionStore(certList);
    }

    return new CollectionStore(new ArrayList());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:29,代码来源:OriginatorInformation.java

示例10: execute0

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
@Override
protected Object execute0() throws Exception {
    Certificate cert = Certificate.getInstance(IoUtil.read(inFile));

    if (serial != null && serial) {
        return getNumber(cert.getSerialNumber().getPositiveValue());
    } else if (subject != null && subject) {
        return cert.getSubject().toString();
    } else if (issuer != null && issuer) {
        return cert.getIssuer().toString();
    } else if (notBefore != null && notBefore) {
        return toUtcTimeyyyyMMddhhmmssZ(cert.getStartDate().getDate());
    } else if (notAfter != null && notAfter) {
        return toUtcTimeyyyyMMddhhmmssZ(cert.getEndDate().getDate());
    } else if (fingerprint != null && fingerprint) {
        byte[] encoded = cert.getEncoded();
        return HashAlgoType.getHashAlgoType(hashAlgo).hexHash(encoded);
    }

    return null;
}
 
开发者ID:xipki,项目名称:xitk,代码行数:22,代码来源:CertInfoCmd.java

示例11: checkConstruction

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
private void checkConstruction(
    RequestedCertificate requested,
    int type,
    byte[] certOctets,
    Certificate cert)
    throws IOException
{
    checkValues(requested, type, certOctets, cert);

    requested = RequestedCertificate.getInstance(requested);

    checkValues(requested, type, certOctets, cert);

    ASN1InputStream aIn = new ASN1InputStream(requested.toASN1Primitive().getEncoded());

    Object obj = aIn.readObject();

    requested = RequestedCertificate.getInstance(obj);

    checkValues(requested, type, certOctets, cert);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:22,代码来源:RequestedCertificateUnitTest.java

示例12: checkValues

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
private void checkValues(
    RequestedCertificate requested,
    int type,
    byte[] certOctets,
    Certificate cert)
    throws IOException
{
    checkMandatoryField("certType", type, requested.getType());

    if (requested.getType() == RequestedCertificate.certificate)
    {
        checkMandatoryField("certificate", cert.getEncoded(), requested.getCertificateBytes());
    }
    else
    {
        checkMandatoryField("certificateOctets", certOctets, requested.getCertificateBytes());
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:19,代码来源:RequestedCertificateUnitTest.java

示例13: buildCRT

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
private static byte[] buildCRT(TBSCertificate tbs, AlgorithmIdentifier aid, byte[] sig) {
    ASN1EncodableVector v = new ASN1EncodableVector();
    v.add(tbs);
    v.add(aid);
    v.add(new DERBitString(sig));

    byte [] crt = null;
    try {
        Certificate c = Certificate.getInstance(new DERSequence(v));
        crt = c.getEncoded();
        Base64.encode(crt, System.out);
        System.out.println("");
    } catch (Exception ex) {
        ex.printStackTrace(System.out);
        Assert.fail();
    }
    return crt;
}
 
开发者ID:mbrossard,项目名称:cryptonit-applet,代码行数:19,代码来源:PivTest.java

示例14: readDERCertificate

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
private java.security.cert.Certificate readDERCertificate(
    ASN1InputStream dIn)
    throws IOException, CertificateParsingException
{
    ASN1Sequence seq = (ASN1Sequence)dIn.readObject();

    if (seq.size() > 1
            && seq.getObjectAt(0) instanceof ASN1ObjectIdentifier)
    {
        if (seq.getObjectAt(0).equals(PKCSObjectIdentifiers.signedData))
        {
            sData = SignedData.getInstance(ASN1Sequence.getInstance(
                (ASN1TaggedObject)seq.getObjectAt(1), true)).getCertificates();

            return getCertificate();
        }
    }

    return new X509CertificateObject(bcHelper,
                        Certificate.getInstance(seq));
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:22,代码来源:CertificateFactory.java

示例15: getCertificate

import org.bouncycastle.asn1.x509.Certificate; //导入依赖的package包/类
private java.security.cert.Certificate getCertificate()
    throws CertificateParsingException
{
    if (sData != null)
    {
        while (sDataObjectCount < sData.size())
        {
            Object obj = sData.getObjectAt(sDataObjectCount++);

            if (obj instanceof ASN1Sequence)
            {
               return new X509CertificateObject(bcHelper,
                                Certificate.getInstance(obj));
            }
        }
    }

    return null;
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:20,代码来源:CertificateFactory.java


注:本文中的org.bouncycastle.asn1.x509.Certificate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。