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


Java Certificate.getInstance方法代碼示例

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


在下文中一共展示了Certificate.getInstance方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: extractCertificateFromUnsignedAttribute

import org.bouncycastle.asn1.x509.Certificate; //導入方法依賴的package包/類
private void extractCertificateFromUnsignedAttribute(List<CertificateToken> encapsulatedCerts, Attribute attribute) {
	if (attribute != null) {
		final ASN1Sequence seq = (ASN1Sequence) attribute.getAttrValues().getObjectAt(0);
		for (int ii = 0; ii < seq.size(); ii++) {
			try {
				final Certificate cs = Certificate.getInstance(seq.getObjectAt(ii));
				final CertificateToken certToken = addCertificate(DSSUtils.loadCertificate(cs.getEncoded()));
				if (!encapsulatedCerts.contains(certToken)) {
					encapsulatedCerts.add(certToken);
				}
			} catch (Exception e) {
				LOG.warn("Unable to parse encapsulated certificate : " + e.getMessage());
			}
		}
	}
}
 
開發者ID:esig,項目名稱:dss,代碼行數:17,代碼來源:CAdESCertificateSource.java

示例12: 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:mlundblad,項目名稱:bc-java,代碼行數:19,代碼來源:X509V1CertificateGenerator.java

示例13: generateJcaObject

import org.bouncycastle.asn1.x509.Certificate; //導入方法依賴的package包/類
private X509Certificate generateJcaObject(TBSCertificate tbsCert, byte[] signature)
    throws CertificateParsingException
{
    ASN1EncodableVector v = new ASN1EncodableVector();

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

    return new X509CertificateObject(Certificate.getInstance(new DERSequence(v)));
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:12,代碼來源:X509V3CertificateGenerator.java

示例14: generateStructure

import org.bouncycastle.asn1.x509.Certificate; //導入方法依賴的package包/類
private static Certificate generateStructure(TBSCertificate tbsCert, AlgorithmIdentifier sigAlgId, byte[] signature)
{
    ASN1EncodableVector v = new ASN1EncodableVector();

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

    return Certificate.getInstance(new DERSequence(v));
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:11,代碼來源:CertUtils.java

示例15: getCerts

import org.bouncycastle.asn1.x509.Certificate; //導入方法依賴的package包/類
public X509CertificateHolder[] getCerts()
{
    //
    // load the certificates if we have any
    //
    if (req.getOptionalSignature() != null)
    {
        ASN1Sequence s = req.getOptionalSignature().getCerts();

        if (s != null)
        {
            X509CertificateHolder[] certs = new X509CertificateHolder[s.size()];

            for (int i = 0; i != certs.length; i++)
            {
                certs[i] = new X509CertificateHolder(Certificate.getInstance(s.getObjectAt(i)));
            }

            return certs;
        }

        return EMPTY_CERTS;
    }
    else
    {
        return EMPTY_CERTS;
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:29,代碼來源:OCSPReq.java


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