• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java ExtCertPathValidatorException类的典型用法和代码示例

java 1次浏览

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

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

示例1: getAlgorithmIdentifier

点赞 3

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static AlgorithmIdentifier getAlgorithmIdentifier(
    PublicKey key)
    throws CertPathValidatorException
{
    try
    {
        ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());

        SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());

        return info.getAlgorithmId();
    }
    catch (Exception e)
    {
        throw new ExtCertPathValidatorException("Subject public key cannot be decoded.", e);
    }
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:18,
代码来源:CertPathValidatorUtilities.java

示例2: processCertF

点赞 3

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static void processCertF(
    CertPath certPath,
    int index,
    PKIXPolicyNode validPolicyTree,
    int explicitPolicy)
    throws CertPathValidatorException
{
    //
    // (f)
    //
    if (explicitPolicy <= 0 && validPolicyTree == null)
    {
        throw new ExtCertPathValidatorException("No valid policy tree found when one expected.", null, certPath,
            index);
    }
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:17,
代码来源:RFC3280CertPathUtilities.java

示例3: prepareNextCertL

点赞 3

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static int prepareNextCertL(
    CertPath certPath,
    int index,
    int maxPathLength)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);
    //
    // (l)
    //
    if (!CertPathValidatorUtilities.isSelfIssued(cert))
    {
        if (maxPathLength <= 0)
        {
            throw new ExtCertPathValidatorException("Max path length not greater than zero", null, certPath, index);
        }

        return maxPathLength - 1;
    }
    return maxPathLength;
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:23,
代码来源:RFC3280CertPathUtilities.java

示例4: prepareNextCertN

点赞 3

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static void prepareNextCertN(
    CertPath certPath,
    int index)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);

    //
    // (n)
    //
    boolean[] _usage = cert.getKeyUsage();

    if ((_usage != null) && !_usage[RFC3280CertPathUtilities.KEY_CERT_SIGN])
    {
        throw new ExtCertPathValidatorException(
            "Issuer certificate keyusage extension is critical and does not permit key signing.", null,
            certPath, index);
    }
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:21,
代码来源:RFC3280CertPathUtilities.java

示例5: getAlgorithmIdentifier

点赞 3

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static AlgorithmIdentifier getAlgorithmIdentifier(
    PublicKey key)
    throws CertPathValidatorException
{
    try
    {
        ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());

        SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());

        return info.getAlgorithm();
    }
    catch (Exception e)
    {
        throw new ExtCertPathValidatorException("Subject public key cannot be decoded.", e);
    }
}
 

开发者ID:thedrummeraki,
项目名称:Aki-SSL,
代码行数:18,
代码来源:CertPathValidatorUtilities.java

示例6: getQualifierSet

点赞 2

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static final Set getQualifierSet(ASN1Sequence qualifiers)
    throws CertPathValidatorException
{
    Set pq = new HashSet();

    if (qualifiers == null)
    {
        return pq;
    }

    ByteArrayOutputStream bOut = new ByteArrayOutputStream();
    ASN1OutputStream aOut = new ASN1OutputStream(bOut);

    Enumeration e = qualifiers.getObjects();

    while (e.hasMoreElements())
    {
        try
        {
            aOut.writeObject((ASN1Encodable)e.nextElement());

            pq.add(new PolicyQualifierInfo(bOut.toByteArray()));
        }
        catch (IOException ex)
        {
            throw new ExtCertPathValidatorException("Policy qualifier info cannot be decoded.", ex);
        }

        bOut.reset();
    }

    return pq;
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:34,
代码来源:CertPathValidatorUtilities.java

示例7: processCertE

点赞 2

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static PKIXPolicyNode processCertE(
    CertPath certPath,
    int index,
    PKIXPolicyNode validPolicyTree)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);
    // 
    // (e)
    //
    ASN1Sequence certPolicies = null;
    try
    {
        certPolicies = DERSequence.getInstance(CertPathValidatorUtilities.getExtensionValue(cert,
            RFC3280CertPathUtilities.CERTIFICATE_POLICIES));
    }
    catch (AnnotatedException e)
    {
        throw new ExtCertPathValidatorException("Could not read certificate policies extension from certificate.",
            e, certPath, index);
    }
    if (certPolicies == null)
    {
        validPolicyTree = null;
    }
    return validPolicyTree;
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:29,
代码来源:RFC3280CertPathUtilities.java

示例8: prepareNextCertJ

点赞 2

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static int prepareNextCertJ(
    CertPath certPath,
    int index,
    int inhibitAnyPolicy)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);
    //
    // (j)
    //
    DERInteger iap = null;
    try
    {
        iap = DERInteger.getInstance(CertPathValidatorUtilities.getExtensionValue(cert,
            RFC3280CertPathUtilities.INHIBIT_ANY_POLICY));
    }
    catch (Exception e)
    {
        throw new ExtCertPathValidatorException("Inhibit any-policy extension cannot be decoded.", e, certPath,
            index);
    }

    if (iap != null)
    {
        int _inhibitAnyPolicy = iap.getValue().intValue();

        if (_inhibitAnyPolicy < inhibitAnyPolicy)
        {
            return _inhibitAnyPolicy;
        }
    }
    return inhibitAnyPolicy;
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:35,
代码来源:RFC3280CertPathUtilities.java

示例9: prepareNextCertK

点赞 2

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static void prepareNextCertK(
    CertPath certPath,
    int index)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);
    //
    // (k)
    //
    BasicConstraints bc = null;
    try
    {
        bc = BasicConstraints.getInstance(CertPathValidatorUtilities.getExtensionValue(cert,
            RFC3280CertPathUtilities.BASIC_CONSTRAINTS));
    }
    catch (Exception e)
    {
        throw new ExtCertPathValidatorException("Basic constraints extension cannot be decoded.", e, certPath,
            index);
    }
    if (bc != null)
    {
        if (!(bc.isCA()))
        {
            throw new CertPathValidatorException("Not a CA certificate");
        }
    }
    else
    {
        throw new CertPathValidatorException("Intermediate certificate lacks BasicConstraints");
    }
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:34,
代码来源:RFC3280CertPathUtilities.java

示例10: prepareNextCertM

点赞 2

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static int prepareNextCertM(
    CertPath certPath,
    int index,
    int maxPathLength)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);

    //
    // (m)
    //
    BasicConstraints bc = null;
    try
    {
        bc = BasicConstraints.getInstance(CertPathValidatorUtilities.getExtensionValue(cert,
            RFC3280CertPathUtilities.BASIC_CONSTRAINTS));
    }
    catch (Exception e)
    {
        throw new ExtCertPathValidatorException("Basic constraints extension cannot be decoded.", e, certPath,
            index);
    }
    if (bc != null)
    {
        BigInteger _pathLengthConstraint = bc.getPathLenConstraint();

        if (_pathLengthConstraint != null)
        {
            int _plc = _pathLengthConstraint.intValue();

            if (_plc < maxPathLength)
            {
                return _plc;
            }
        }
    }
    return maxPathLength;
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:40,
代码来源:RFC3280CertPathUtilities.java

示例11: prepareNextCertO

点赞 2

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static void prepareNextCertO(
    CertPath certPath,
    int index,
    Set criticalExtensions,
    List pathCheckers)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);
    //
    // (o)
    //

    Iterator tmpIter;
    tmpIter = pathCheckers.iterator();
    while (tmpIter.hasNext())
    {
        try
        {
            ((PKIXCertPathChecker)tmpIter.next()).check(cert, criticalExtensions);
        }
        catch (CertPathValidatorException e)
        {
            throw new CertPathValidatorException(e.getMessage(), e.getCause(), certPath, index);
        }
    }
    if (!criticalExtensions.isEmpty())
    {
        throw new ExtCertPathValidatorException("Certificate has unsupported critical extension: " + criticalExtensions, null, certPath,
            index);
    }
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:33,
代码来源:RFC3280CertPathUtilities.java

示例12: wrapupCertF

点赞 2

import org.bouncycastle.jce.exception.ExtCertPathValidatorException; //导入依赖的package包/类
protected static void wrapupCertF(
    CertPath certPath,
    int index,
    List pathCheckers,
    Set criticalExtensions)
    throws CertPathValidatorException
{
    List certs = certPath.getCertificates();
    X509Certificate cert = (X509Certificate)certs.get(index);
    Iterator tmpIter;
    tmpIter = pathCheckers.iterator();
    while (tmpIter.hasNext())
    {
        try
        {
            ((PKIXCertPathChecker)tmpIter.next()).check(cert, criticalExtensions);
        }
        catch (CertPathValidatorException e)
        {
            throw new ExtCertPathValidatorException("Additional certificate path checker failed.", e, certPath,
                index);
        }
    }

    if (!criticalExtensions.isEmpty())
    {
        throw new ExtCertPathValidatorException("Certificate has unsupported critical extension: " + criticalExtensions, null, certPath,
            index);
    }
}
 

开发者ID:Appdome,
项目名称:ipack,
代码行数:31,
代码来源:RFC3280CertPathUtilities.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)