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


Java Extension.isCritical方法代碼示例

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


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

示例1: getExtensionOIDs

import org.bouncycastle.asn1.x509.Extension; //導入方法依賴的package包/類
private Set getExtensionOIDs(
    boolean critical) 
{
    Extensions  extensions = cert.getAcinfo().getExtensions();

    if (extensions != null)
    {
        Set             set = new HashSet();
        Enumeration     e = extensions.oids();

        while (e.hasMoreElements())
        {
            ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
            Extension            ext = extensions.getExtension(oid);

            if (ext.isCritical() == critical)
            {
                set.add(oid.getId());
            }
        }

        return set;
    }

    return null;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:27,代碼來源:X509V2AttributeCertificate.java

示例2: getExtensionOIDs

import org.bouncycastle.asn1.x509.Extension; //導入方法依賴的package包/類
private Set getExtensionOIDs(boolean critical)
{
    Extensions extensions = c.getExtensions();

    if (extensions != null)
    {
        Set set = new HashSet();
        Enumeration e = extensions.oids();

        while (e.hasMoreElements())
        {
            ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier) e.nextElement();
            Extension ext = extensions.getExtension(oid);

            if (critical == ext.isCritical())
            {
                set.add(oid.getId());
            }
        }

        return set;
    }

    return null;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:26,代碼來源:X509CRLEntryObject.java

示例3: getCriticalExtensionOIDs

import org.bouncycastle.asn1.x509.Extension; //導入方法依賴的package包/類
public Set getCriticalExtensionOIDs() 
{
    if (this.getVersion() == 3)
    {
        Set             set = new HashSet();
        Extensions  extensions = c.getTBSCertificate().getExtensions();

        if (extensions != null)
        {
            Enumeration     e = extensions.oids();

            while (e.hasMoreElements())
            {
                ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
                Extension       ext = extensions.getExtension(oid);

                if (ext.isCritical())
                {
                    set.add(oid.getId());
                }
            }

            return set;
        }
    }

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

示例4: getNonCriticalExtensionOIDs

import org.bouncycastle.asn1.x509.Extension; //導入方法依賴的package包/類
public Set getNonCriticalExtensionOIDs() 
{
    if (this.getVersion() == 3)
    {
        Set             set = new HashSet();
        Extensions  extensions = c.getTBSCertificate().getExtensions();

        if (extensions != null)
        {
            Enumeration     e = extensions.oids();

            while (e.hasMoreElements())
            {
                ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
                Extension       ext = extensions.getExtension(oid);

                if (!ext.isCritical())
                {
                    set.add(oid.getId());
                }
            }

            return set;
        }
    }

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

示例5: getExtensionOIDs

import org.bouncycastle.asn1.x509.Extension; //導入方法依賴的package包/類
private Set getExtensionOIDs(boolean critical)
{
    if (this.getVersion() == 2)
    {
        Extensions extensions = c.getTBSCertList().getExtensions();

        if (extensions != null)
        {
            Set set = new HashSet();
            Enumeration e = extensions.oids();

            while (e.hasMoreElements())
            {
                ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
                Extension ext = extensions.getExtension(oid);

                if (critical == ext.isCritical())
                {
                    set.add(oid.getId());
                }
            }

            return set;
        }
    }

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

示例6: validateCertificate

import org.bouncycastle.asn1.x509.Extension; //導入方法依賴的package包/類
/**
 * Validate the passed in certificate as being of the correct type to be used
 * for time stamping. To be valid it must have an ExtendedKeyUsage extension
 * which has a key purpose identifier of id-kp-timeStamping.
 *
 * @param cert the certificate of interest.
 * @throws TSPValidationException if the certicate fails on one of the check points.
 */
public static void validateCertificate(
    X509CertificateHolder cert)
    throws TSPValidationException
{
    if (cert.toASN1Structure().getVersionNumber() != 3)
    {
        throw new IllegalArgumentException("Certificate must have an ExtendedKeyUsage extension.");
    }

    Extension ext = cert.getExtension(Extension.extendedKeyUsage);
    if (ext == null)
    {
        throw new TSPValidationException("Certificate must have an ExtendedKeyUsage extension.");
    }

    if (!ext.isCritical())
    {
        throw new TSPValidationException("Certificate must have an ExtendedKeyUsage extension marked as critical.");
    }

    ExtendedKeyUsage    extKey = ExtendedKeyUsage.getInstance(ext.getParsedValue());

    if (!extKey.hasKeyPurposeId(KeyPurposeId.id_kp_timeStamping) || extKey.size() != 1)
    {
        throw new TSPValidationException("ExtendedKeyUsage not solely time stamping.");
    }
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:36,代碼來源:TSPUtil.java

示例7: validateCertificate

import org.bouncycastle.asn1.x509.Extension; //導入方法依賴的package包/類
/**
 * Validate the passed in certificate as being of the correct type to be used
 * for time stamping. To be valid it must have an ExtendedKeyUsage extension
 * which has a key purpose identifier of id-kp-timeStamping.
 *
 * @param cert the certificate of interest.
 * @throws TSPValidationException if the certificate fails on one of the check points.
 */
public static void validateCertificate(
    X509CertificateHolder cert)
    throws TSPValidationException
{
    if (cert.toASN1Structure().getVersionNumber() != 3)
    {
        throw new IllegalArgumentException("Certificate must have an ExtendedKeyUsage extension.");
    }

    Extension ext = cert.getExtension(Extension.extendedKeyUsage);
    if (ext == null)
    {
        throw new TSPValidationException("Certificate must have an ExtendedKeyUsage extension.");
    }

    if (!ext.isCritical())
    {
        throw new TSPValidationException("Certificate must have an ExtendedKeyUsage extension marked as critical.");
    }

    ExtendedKeyUsage    extKey = ExtendedKeyUsage.getInstance(ext.getParsedValue());

    if (!extKey.hasKeyPurposeId(KeyPurposeId.id_kp_timeStamping) || extKey.size() != 1)
    {
        throw new TSPValidationException("ExtendedKeyUsage not solely time stamping.");
    }
}
 
開發者ID:ttt43ttt,項目名稱:gwt-crypto,代碼行數:36,代碼來源:TSPUtil.java

示例8: hasUnsupportedCriticalExtension

import org.bouncycastle.asn1.x509.Extension; //導入方法依賴的package包/類
public boolean hasUnsupportedCriticalExtension()
{
    if (this.getVersion() == 3)
    {
        Extensions  extensions = c.getTBSCertificate().getExtensions();

        if (extensions != null)
        {
            Enumeration     e = extensions.oids();

            while (e.hasMoreElements())
            {
                ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
                String              oidId = oid.getId();

                if (oidId.equals(RFC3280CertPathUtilities.KEY_USAGE)
                 || oidId.equals(RFC3280CertPathUtilities.CERTIFICATE_POLICIES)
                 || oidId.equals(RFC3280CertPathUtilities.POLICY_MAPPINGS)
                 || oidId.equals(RFC3280CertPathUtilities.INHIBIT_ANY_POLICY)
                 || oidId.equals(RFC3280CertPathUtilities.CRL_DISTRIBUTION_POINTS)
                 || oidId.equals(RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT)
                 || oidId.equals(RFC3280CertPathUtilities.DELTA_CRL_INDICATOR)
                 || oidId.equals(RFC3280CertPathUtilities.POLICY_CONSTRAINTS)
                 || oidId.equals(RFC3280CertPathUtilities.BASIC_CONSTRAINTS)
                 || oidId.equals(RFC3280CertPathUtilities.SUBJECT_ALTERNATIVE_NAME)
                 || oidId.equals(RFC3280CertPathUtilities.NAME_CONSTRAINTS))
                {
                    continue;
                }

                Extension       ext = extensions.getExtension(oid);

                if (ext.isCritical())
                {
                    return true;
                }
            }
        }
    }

    return false;
}
 
開發者ID:Appdome,項目名稱:ipack,代碼行數:43,代碼來源:X509CertificateObject.java

示例9: hasUnsupportedCriticalExtension

import org.bouncycastle.asn1.x509.Extension; //導入方法依賴的package包/類
public boolean hasUnsupportedCriticalExtension()
{
    if (this.getVersion() == 3)
    {
        Extensions  extensions = c.getTBSCertificate().getExtensions();

        if (extensions != null)
        {
            Enumeration     e = extensions.oids();

            while (e.hasMoreElements())
            {
                ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();

                if (oid.equals(Extension.keyUsage)
                 || oid.equals(Extension.certificatePolicies)
                 || oid.equals(Extension.policyMappings)
                 || oid.equals(Extension.inhibitAnyPolicy)
                 || oid.equals(Extension.cRLDistributionPoints)
                 || oid.equals(Extension.issuingDistributionPoint)
                 || oid.equals(Extension.deltaCRLIndicator)
                 || oid.equals(Extension.policyConstraints)
                 || oid.equals(Extension.basicConstraints)
                 || oid.equals(Extension.subjectAlternativeName)
                 || oid.equals(Extension.nameConstraints))
                {
                    continue;
                }

                Extension       ext = extensions.getExtension(oid);

                if (ext.isCritical())
                {
                    return true;
                }
            }
        }
    }

    return false;
}
 
開發者ID:thedrummeraki,項目名稱:Aki-SSL,代碼行數:42,代碼來源:X509CertificateObject.java


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