当前位置: 首页>>代码示例>>Java>>正文


Java PKIXParameters.getTargetCertConstraints方法代码示例

本文整理汇总了Java中java.security.cert.PKIXParameters.getTargetCertConstraints方法的典型用法代码示例。如果您正苦于以下问题:Java PKIXParameters.getTargetCertConstraints方法的具体用法?Java PKIXParameters.getTargetCertConstraints怎么用?Java PKIXParameters.getTargetCertConstraints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.security.cert.PKIXParameters的用法示例。


在下文中一共展示了PKIXParameters.getTargetCertConstraints方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetTargetCertConstraints02

import java.security.cert.PKIXParameters; //导入方法依赖的package包/类
/**
 * Test #2 for <code>getTargetCertConstraints()</code> method<br>
 * Assertion: note that the <code>CertSelector</code> returned
 * is cloned to protect against subsequent modifications
 * @throws InvalidAlgorithmParameterException
 * @throws IOException
 */
public final void testGetTargetCertConstraints02() throws Exception {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }

    X509CertSelector x509cs = new X509CertSelector();
    PKIXParameters p = new PKIXParameters(taSet);
    p.setTargetCertConstraints(x509cs);
    // get cert selector
    X509CertSelector cs1 = (X509CertSelector)p.getTargetCertConstraints();
    // modify returned selector
    cs1.setIssuer(testIssuer);
    // get cert selector again
    X509CertSelector cs2 = (X509CertSelector)p.getTargetCertConstraints();
    // check that selector is not the same
    assertNotSame("notTheSame", cs1, cs2);
    // check that selector's internal state has
    // not been changed by above modification
    assertFalse("stateNotChanged", testIssuer.equals(cs2.getIssuerAsString()));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:29,代码来源:PKIXParametersTest.java

示例2: testSetTargetCertConstraints02

import java.security.cert.PKIXParameters; //导入方法依赖的package包/类
/**
 * Test #2 for <code>setTargetCertConstraints(CertSelector)</code> method<br>
 * Assertion: ... the CertSelector specified is cloned to protect against
 * subsequent modifications
 * @throws IOException
 * @throws InvalidAlgorithmParameterException
 */
public final void testSetTargetCertConstraints02() throws Exception {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }

    X509CertSelector x509cs = new X509CertSelector();
    PKIXParameters p = new PKIXParameters(taSet);
    p.setTargetCertConstraints(x509cs);
    // modify selector
    x509cs.setIssuer(testIssuer);
    // get selector
    X509CertSelector x509cs1 = (X509CertSelector)p.getTargetCertConstraints();
    // check that selector's internal state has
    // not been changed by above modification
    assertFalse(testIssuer.equals(x509cs1.getIssuerAsString()));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:PKIXParametersTest.java

示例3: Builder

import java.security.cert.PKIXParameters; //导入方法依赖的package包/类
public Builder(PKIXParameters baseParameters)
{
    this.baseParameters = (PKIXParameters)baseParameters.clone();
    CertSelector constraints = baseParameters.getTargetCertConstraints();
    if (constraints != null)
    {
        this.targetConstraints = new PKIXCertStoreSelector.Builder(constraints).build();
    }
    Date checkDate = baseParameters.getDate();
    this.date = (checkDate == null) ? new Date() : checkDate;
    this.revocationEnabled = baseParameters.isRevocationEnabled();
    this.trustAnchors = baseParameters.getTrustAnchors();
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:14,代码来源:PKIXExtendedParameters.java

示例4: doValidate

import java.security.cert.PKIXParameters; //导入方法依赖的package包/类
/**
 * Internal method to actually validate a constructed path.
 *
 * @return the valid policy tree
 */
private PolicyNode doValidate(
        TrustAnchor anchor, CertPath cpOriginal,
        ArrayList<X509Certificate> certList, PKIXParameters pkixParam,
        PolicyNodeImpl rootNode) throws CertPathValidatorException
{
    int certPathLen = certList.size();

    basicChecker = new BasicChecker(anchor, testDate, sigProvider, false);
    AlgorithmChecker algorithmChecker = new AlgorithmChecker(anchor);
    KeyChecker keyChecker = new KeyChecker(certPathLen,
        pkixParam.getTargetCertConstraints());
    ConstraintsChecker constraintsChecker =
        new ConstraintsChecker(certPathLen);

    PolicyChecker policyChecker =
        new PolicyChecker(pkixParam.getInitialPolicies(), certPathLen,
                          pkixParam.isExplicitPolicyRequired(),
                          pkixParam.isPolicyMappingInhibited(),
                          pkixParam.isAnyPolicyInhibited(),
                          pkixParam.getPolicyQualifiersRejected(),
                          rootNode);

    ArrayList<PKIXCertPathChecker> certPathCheckers =
        new ArrayList<PKIXCertPathChecker>();
    // add standard checkers that we will be using
    certPathCheckers.add(algorithmChecker);
    certPathCheckers.add(keyChecker);
    certPathCheckers.add(constraintsChecker);
    certPathCheckers.add(policyChecker);
    certPathCheckers.add(basicChecker);

    // only add a revocationChecker if revocation is enabled
    if (pkixParam.isRevocationEnabled()) {

        // Use OCSP if it has been enabled
        if (ocspEnabled) {
            OCSPChecker ocspChecker =
                new OCSPChecker(cpOriginal, pkixParam, onlyEECert);
            certPathCheckers.add(ocspChecker);
        }

        // Always use CRLs
        CrlRevocationChecker revocationChecker = new
            CrlRevocationChecker(anchor, pkixParam, certList, onlyEECert);
        certPathCheckers.add(revocationChecker);
    }

    // add user-specified checkers
    certPathCheckers.addAll(userCheckers);

    PKIXMasterCertPathValidator masterValidator =
        new PKIXMasterCertPathValidator(certPathCheckers);

    masterValidator.validate(cpOriginal, certList);

    return policyChecker.getPolicyTree();
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:63,代码来源:PKIXCertPathValidator.java

示例5: doValidate

import java.security.cert.PKIXParameters; //导入方法依赖的package包/类
/**
 * Internal method to actually validate a constructed path.
 *
 * @return the valid policy tree
 */
private PolicyNode doValidate(
        TrustAnchor anchor, CertPath cpOriginal,
        ArrayList<X509Certificate> certList, PKIXParameters pkixParam,
        PolicyNodeImpl rootNode) throws CertPathValidatorException
{
    int certPathLen = certList.size();

    basicChecker = new BasicChecker(anchor, testDate, sigProvider, false);
    AlgorithmChecker algorithmChecker = new AlgorithmChecker(anchor);
    KeyChecker keyChecker = new KeyChecker(certPathLen,
        pkixParam.getTargetCertConstraints());
    ConstraintsChecker constraintsChecker =
        new ConstraintsChecker(certPathLen);

    PolicyChecker policyChecker =
        new PolicyChecker(pkixParam.getInitialPolicies(), certPathLen,
                          pkixParam.isExplicitPolicyRequired(),
                          pkixParam.isPolicyMappingInhibited(),
                          pkixParam.isAnyPolicyInhibited(),
                          pkixParam.getPolicyQualifiersRejected(),
                          rootNode);
    UntrustedChecker untrustedChecker = new UntrustedChecker();

    ArrayList<PKIXCertPathChecker> certPathCheckers =
        new ArrayList<PKIXCertPathChecker>();
    // add standard checkers that we will be using
    certPathCheckers.add(untrustedChecker);
    certPathCheckers.add(algorithmChecker);
    certPathCheckers.add(keyChecker);
    certPathCheckers.add(constraintsChecker);
    certPathCheckers.add(policyChecker);
    certPathCheckers.add(basicChecker);

    // only add a revocationChecker if revocation is enabled
    if (pkixParam.isRevocationEnabled()) {

        // Use OCSP if it has been enabled
        if (ocspEnabled) {
            OCSPChecker ocspChecker =
                new OCSPChecker(cpOriginal, pkixParam, onlyEECert);
            certPathCheckers.add(ocspChecker);
        }

        // Always use CRLs
        CrlRevocationChecker revocationChecker = new
            CrlRevocationChecker(anchor, pkixParam, certList, onlyEECert);
        certPathCheckers.add(revocationChecker);
    }

    // add user-specified checkers
    certPathCheckers.addAll(userCheckers);

    PKIXMasterCertPathValidator masterValidator =
        new PKIXMasterCertPathValidator(certPathCheckers);

    masterValidator.validate(cpOriginal, certList);

    return policyChecker.getPolicyTree();
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:65,代码来源:PKIXCertPathValidator.java


注:本文中的java.security.cert.PKIXParameters.getTargetCertConstraints方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。