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