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


Java X509CRL.getExtensionValue方法代碼示例

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


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

示例1: isIndirectCRL

import java.security.cert.X509CRL; //導入方法依賴的package包/類
static boolean isIndirectCRL(X509CRL crl)
    throws CRLException
{
    try
    {
        byte[] idp = crl.getExtensionValue(Extension.issuingDistributionPoint.getId());
        return idp != null
            && IssuingDistributionPoint.getInstance(ASN1OctetString.getInstance(idp).getOctets()).isIndirectCRL();
    }
    catch (Exception e)
    {
        throw new ExtCRLException(
                "Exception reading IssuingDistributionPoint", e);
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:16,代碼來源:X509CRLObject.java

示例2: match

import java.security.cert.X509CRL; //導入方法依賴的package包/類
public boolean match(Object obj)
{
    if (!(obj instanceof X509CRL))
    {
        return false;
    }
    X509CRL crl = (X509CRL)obj;
    DERInteger dci = null;
    try
    {
        byte[] bytes = crl
            .getExtensionValue(X509Extensions.DeltaCRLIndicator.getId());
        if (bytes != null)
        {
            dci = DERInteger.getInstance(X509ExtensionUtil
                .fromExtensionValue(bytes));
        }
    }
    catch (Exception e)
    {
        return false;
    }
    if (isDeltaCRLIndicatorEnabled())
    {
        if (dci == null)
        {
            return false;
        }
    }
    if (isCompleteCRLEnabled())
    {
        if (dci != null)
        {
            return false;
        }
    }
    if (dci != null)
    {

        if (maxBaseCRLNumber != null)
        {
            if (dci.getPositiveValue().compareTo(maxBaseCRLNumber) == 1)
            {
                return false;
            }
        }
    }
    if (issuingDistributionPointEnabled)
    {
        byte[] idp = crl
            .getExtensionValue(X509Extensions.IssuingDistributionPoint
                .getId());
        if (issuingDistributionPoint == null)
        {
            if (idp != null)
            {
                return false;
            }
        }
        else
        {
            if (!Arrays.areEqual(idp, issuingDistributionPoint))
            {
                return false;
            }
        }

    }
    return super.match((X509CRL)obj);
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:71,代碼來源:X509CRLStoreSelector.java

示例3: execute0

import java.security.cert.X509CRL; //導入方法依賴的package包/類
@Override
protected Object execute0() throws Exception {
    X509CRL crl = X509Util.parseCrl(crlFile);
    String oidExtnCerts = ObjectIdentifiers.id_xipki_ext_crlCertset.getId();
    byte[] extnValue = crl.getExtensionValue(oidExtnCerts);
    if (extnValue == null) {
        throw new IllegalCmdParamException("no certificate is contained in " + crlFile);
    }

    extnValue = removingTagAndLenFromExtensionValue(extnValue);
    ASN1Set asn1Set = DERSet.getInstance(extnValue);
    final int n = asn1Set.size();
    if (n == 0) {
        throw new CmdFailure("no certificate is contained in " + crlFile);
    }

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ZipOutputStream zip = new ZipOutputStream(out);

    for (int i = 0; i < n; i++) {
        ASN1Encodable asn1 = asn1Set.getObjectAt(i);
        Certificate cert;
        try {
            ASN1Sequence seq = ASN1Sequence.getInstance(asn1);
            cert = Certificate.getInstance(seq.getObjectAt(0));
        } catch (IllegalArgumentException ex) {
            // backwards compatibility
            cert = Certificate.getInstance(asn1);
        }

        byte[] certBytes = cert.getEncoded();
        String sha1FpCert = HashAlgoType.SHA1.hexHash(certBytes);
        ZipEntry certZipEntry = new ZipEntry(sha1FpCert + ".der");
        zip.putNextEntry(certZipEntry);
        try {
            zip.write(certBytes);
        } finally {
            zip.closeEntry();
        }
    }

    zip.flush();
    zip.close();

    saveVerbose("extracted " + n + " certificates to", new File(outFile), out.toByteArray());
    return null;
}
 
開發者ID:xipki,項目名稱:xitk,代碼行數:48,代碼來源:ExtractCertFromCrlCmd.java


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