Java 类java.security.cert.CertPathBuilderResult 实例源码

项目:In-the-Box-Fork    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test #1 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
 *   PolicyNode, PublicKey)</code> constructor<br>
 * Assertion: Creates an instance of <code>PKIXCertPathBuilderResult</code>
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
@TestTargetNew(
    level = TestLevel.PARTIAL_COMPLETE,
    method = "PKIXCertPathBuilderResult",
    args = {java.security.cert.CertPath.class, java.security.cert.TrustAnchor.class, java.security.cert.PolicyNode.class, java.security.PublicKey.class}
)
public final void testPKIXCertPathBuilderResult01()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);
    assertTrue(r instanceof PKIXCertPathBuilderResult);
}
项目:In-the-Box-Fork    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test #2 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
 *   PolicyNode, PublicKey)</code> constructor<br>
 * Assertion: policy tree parameter may be <code>null</code>
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
@TestTargetNew(
    level = TestLevel.PARTIAL_COMPLETE,
    method = "PKIXCertPathBuilderResult",
    args = {java.security.cert.CertPath.class, java.security.cert.TrustAnchor.class, java.security.cert.PolicyNode.class, java.security.PublicKey.class}
)
public final void testPKIXCertPathBuilderResult02()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                null,
                testPublicKey);
    assertTrue(r instanceof PKIXCertPathBuilderResult);
}
项目:In-the-Box-Fork    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test for <code>getCertPath()</code> method<br>
 * Assertion: the built and validated <code>CertPath</code>
 * (never <code>null</code>)
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "getCertPath",
    args = {}
)
public final void testGetCertPath() throws Exception {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }

    CertPath cp = new MyCertPath(testEncoding);
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                cp,
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);

    // must return the same reference
    // as passed to the constructor
    assertSame(cp, r.getCertPath());
}
项目:In-the-Box-Fork    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test for <code>toString()</code> method<br>
 * Assertion: the printable representation of this object
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
@TestTargetNew(
    level = TestLevel.COMPLETE,
    notes = "",
    method = "toString",
    args = {}
)
public final void testToString()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);

    assertNotNull(r.toString());
}
项目:In-the-Box-Fork    文件:CertPathBuilder1Test.java   
@TestTargetNew(
        level=TestLevel.PARTIAL_COMPLETE,
        notes = "Verifies normal case",
        method="build",
        args={CertPathParameters.class}
)
// Test passed on RI
@KnownFailure(value="expired certificate bug 2322662")
public void testBuild() throws Exception {
    TestUtils.initCertPathSSCertChain();
    CertPathParameters params = TestUtils.getCertPathParameters();
    CertPathBuilder builder = TestUtils.getCertPathBuilder();

    try {
        CertPathBuilderResult result = builder.build(params);
        assertNotNull("builder result is null", result);
        CertPath certPath = result.getCertPath();
        assertNotNull("certpath of builder result is null", certPath);
    } catch (InvalidAlgorithmParameterException e) {
        fail("unexpected Exception: " + e);
    }

}
项目:In-the-Box-Fork    文件:CertPathBuilder2Test.java   
private void checkResult(CertPathBuilder certBuild)
        throws InvalidAlgorithmParameterException,
        CertPathBuilderException {
    String dt = CertPathBuilder.getDefaultType();
    String propName = CertPathBuilder1Test.DEFAULT_TYPE_PROPERTY;
    String dtN;
    for (int i = 0; i <invalidValues.length; i++) {
        Security.setProperty(propName, invalidValues[i]);
        dtN = CertPathBuilder.getDefaultType();
        if (!dtN.equals(invalidValues[i]) && !dtN.equals(dt)) {
            fail("Incorrect default type: ".concat(dtN));
        }
    }
    Security.setProperty(propName, dt);
    assertEquals("Incorrect default type", CertPathBuilder.getDefaultType(),
            dt);
    try {
        certBuild.build(null);
        fail("CertPathBuilderException must be thrown");
    } catch (CertPathBuilderException e) {
    }
    CertPathBuilderResult cpbResult = certBuild.build(null);
    assertNull("Not null CertPathBuilderResult", cpbResult);
}
项目:cn1    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test #1 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
 *   PolicyNode, PublicKey)</code> constructor<br>
 * Assertion: Creates an instance of <code>PKIXCertPathBuilderResult</code>
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testPKIXCertPathBuilderResult01()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);
    assertTrue(r instanceof PKIXCertPathBuilderResult);
}
项目:cn1    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test #2 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
 *   PolicyNode, PublicKey)</code> constructor<br>
 * Assertion: policy tree parameter may be <code>null</code>
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testPKIXCertPathBuilderResult02()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                null,
                testPublicKey);
    assertTrue(r instanceof PKIXCertPathBuilderResult);
}
项目:cn1    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test for <code>getCertPath()</code> method<br>
 * Assertion: the built and validated <code>CertPath</code>
 * (never <code>null</code>)
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testGetCertPath() throws Exception {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }

    CertPath cp = new MyCertPath(testEncoding);
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                cp,
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);

    // must return the same reference
    // as passed to the constructor
    assertSame(cp, r.getCertPath());
}
项目:cn1    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test for <code>toString()</code> method<br>
 * Assertion: the printable representation of this object
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testToString()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);

    assertNotNull(r.toString());
}
项目:cn1    文件:CertPathBuilder2Test.java   
private void checkResult(CertPathBuilder certBuild)
        throws InvalidAlgorithmParameterException,
        CertPathBuilderException {
    String dt = CertPathBuilder.getDefaultType();
    String propName = CertPathBuilder1Test.DEFAULT_TYPE_PROPERTY;
    String dtN;
    for (int i = 0; i <invalidValues.length; i++) {
        Security.setProperty(propName, invalidValues[i]);
        dtN = CertPathBuilder.getDefaultType();
        if (!dtN.equals(invalidValues[i]) && !dtN.equals(dt)) {
            fail("Incorrect default type: ".concat(dtN));
        }
    }
    Security.setProperty(propName, dt);
    assertEquals("Incorrect default type", CertPathBuilder.getDefaultType(),
            dt);
    try {
        certBuild.build(null);
        fail("CertPathBuilderException must be thrown");
    } catch (CertPathBuilderException e) {
    }    
    CertPathBuilderResult cpbResult = certBuild.build(null);
    assertNull("Not null CertPathBuilderResult", cpbResult);
}
项目:freeVM    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test #1 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
 *   PolicyNode, PublicKey)</code> constructor<br>
 * Assertion: Creates an instance of <code>PKIXCertPathBuilderResult</code>
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testPKIXCertPathBuilderResult01()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);
    assertTrue(r instanceof PKIXCertPathBuilderResult);
}
项目:freeVM    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test #2 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
 *   PolicyNode, PublicKey)</code> constructor<br>
 * Assertion: policy tree parameter may be <code>null</code>
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testPKIXCertPathBuilderResult02()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                null,
                testPublicKey);
    assertTrue(r instanceof PKIXCertPathBuilderResult);
}
项目:freeVM    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test for <code>getCertPath()</code> method<br>
 * Assertion: the built and validated <code>CertPath</code>
 * (never <code>null</code>)
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testGetCertPath() throws Exception {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }

    CertPath cp = new MyCertPath(testEncoding);
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                cp,
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);

    // must return the same reference
    // as passed to the constructor
    assertSame(cp, r.getCertPath());
}
项目:freeVM    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test for <code>toString()</code> method<br>
 * Assertion: the printable representation of this object
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testToString()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);

    assertNotNull(r.toString());
}
项目:freeVM    文件:CertPathBuilder2Test.java   
private void checkResult(CertPathBuilder certBuild)
        throws InvalidAlgorithmParameterException,
        CertPathBuilderException {
    String dt = CertPathBuilder.getDefaultType();
    String propName = CertPathBuilder1Test.DEFAULT_TYPE_PROPERTY;
    String dtN;
    for (int i = 0; i <invalidValues.length; i++) {
        Security.setProperty(propName, invalidValues[i]);
        dtN = CertPathBuilder.getDefaultType();
        if (!dtN.equals(invalidValues[i]) && !dtN.equals(dt)) {
            fail("Incorrect default type: ".concat(dtN));
        }
    }
    Security.setProperty(propName, dt);
    assertEquals("Incorrect default type", CertPathBuilder.getDefaultType(),
            dt);
    try {
        certBuild.build(null);
        fail("CertPathBuilderException must be thrown");
    } catch (CertPathBuilderException e) {
    }    
    CertPathBuilderResult cpbResult = certBuild.build(null);
    assertNull("Not null CertPathBuilderResult", cpbResult);
}
项目:freeVM    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test #1 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
 *   PolicyNode, PublicKey)</code> constructor<br>
 * Assertion: Creates an instance of <code>PKIXCertPathBuilderResult</code>
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testPKIXCertPathBuilderResult01()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);
    assertTrue(r instanceof PKIXCertPathBuilderResult);
}
项目:freeVM    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test #2 for <code>PKIXCertPathBuilderResult(CertPath, TrustAnchor,
 *   PolicyNode, PublicKey)</code> constructor<br>
 * Assertion: policy tree parameter may be <code>null</code>
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testPKIXCertPathBuilderResult02()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                null,
                testPublicKey);
    assertTrue(r instanceof PKIXCertPathBuilderResult);
}
项目:freeVM    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test for <code>getCertPath()</code> method<br>
 * Assertion: the built and validated <code>CertPath</code>
 * (never <code>null</code>)
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testGetCertPath() throws Exception {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }

    CertPath cp = new MyCertPath(testEncoding);
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                cp,
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);

    // must return the same reference
    // as passed to the constructor
    assertSame(cp, r.getCertPath());
}
项目:freeVM    文件:PKIXCertPathBuilderResultTest.java   
/**
 * Test for <code>toString()</code> method<br>
 * Assertion: the printable representation of this object
 * @throws NoSuchAlgorithmException
 * @throws InvalidKeySpecException
 */
public final void testToString()
    throws InvalidKeySpecException,
           NoSuchAlgorithmException {
    TrustAnchor ta = TestUtils.getTrustAnchor();
    if (ta == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor)");
    }
    CertPathBuilderResult r =
        new PKIXCertPathBuilderResult(
                new MyCertPath(testEncoding),
                ta,
                TestUtils.getPolicyTree(),
                testPublicKey);

    assertNotNull(r.toString());
}
项目:freeVM    文件:CertPathBuilder2Test.java   
private void checkResult(CertPathBuilder certBuild)
        throws InvalidAlgorithmParameterException,
        CertPathBuilderException {
    String dt = CertPathBuilder.getDefaultType();
    String propName = CertPathBuilder1Test.DEFAULT_TYPE_PROPERTY;
    String dtN;
    for (int i = 0; i <invalidValues.length; i++) {
        Security.setProperty(propName, invalidValues[i]);
        dtN = CertPathBuilder.getDefaultType();
        if (!dtN.equals(invalidValues[i]) && !dtN.equals(dt)) {
            fail("Incorrect default type: ".concat(dtN));
        }
    }
    Security.setProperty(propName, dt);
    assertEquals("Incorrect default type", CertPathBuilder.getDefaultType(),
            dt);
    try {
        certBuild.build(null);
        fail("CertPathBuilderException must be thrown");
    } catch (CertPathBuilderException e) {
    }    
    CertPathBuilderResult cpbResult = certBuild.build(null);
    assertNull("Not null CertPathBuilderResult", cpbResult);
}
项目:jdk8u-jdk    文件:NoExtensions.java   
private void doBuild(X509Certificate userCert) throws Exception {
        // get the set of trusted CA certificates (only one in this instance)
        HashSet trustAnchors = new HashSet();
        X509Certificate trustedCert = getTrustedCertificate();
        trustAnchors.add(new TrustAnchor(trustedCert, null));

        // put together a CertStore (repository of the certificates and CRLs)
        ArrayList certs = new ArrayList();
        certs.add(trustedCert);
        certs.add(userCert);
        CollectionCertStoreParameters certStoreParams = new CollectionCertStoreParameters(certs);
        CertStore certStore = CertStore.getInstance("Collection", certStoreParams);

        // specify the target certificate via a CertSelector
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setCertificate(userCert);
        certSelector.setSubject(userCert.getSubjectDN().getName()); // seems to be required

        // build a valid cerificate path
        CertPathBuilder certPathBuilder = CertPathBuilder.getInstance("PKIX", "SUN");
        PKIXBuilderParameters certPathBuilderParams = new PKIXBuilderParameters(trustAnchors, certSelector);
        certPathBuilderParams.addCertStore(certStore);
        certPathBuilderParams.setRevocationEnabled(false);
        CertPathBuilderResult result = certPathBuilder.build(certPathBuilderParams);

        // get and show cert path
        CertPath certPath = result.getCertPath();
//        System.out.println(certPath.toString());
    }
项目:jdk8u-jdk    文件:BuildOddSel.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in building
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:jdk8u-jdk    文件:ValidateNC.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in the build
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX", "SUN");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:openjdk-jdk10    文件:NoExtensions.java   
private void doBuild(X509Certificate userCert) throws Exception {
        // get the set of trusted CA certificates (only one in this instance)
        HashSet trustAnchors = new HashSet();
        X509Certificate trustedCert = getTrustedCertificate();
        trustAnchors.add(new TrustAnchor(trustedCert, null));

        // put together a CertStore (repository of the certificates and CRLs)
        ArrayList certs = new ArrayList();
        certs.add(trustedCert);
        certs.add(userCert);
        CollectionCertStoreParameters certStoreParams = new CollectionCertStoreParameters(certs);
        CertStore certStore = CertStore.getInstance("Collection", certStoreParams);

        // specify the target certificate via a CertSelector
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setCertificate(userCert);
        certSelector.setSubject(userCert.getSubjectDN().getName()); // seems to be required

        // build a valid cerificate path
        CertPathBuilder certPathBuilder = CertPathBuilder.getInstance("PKIX", "SUN");
        PKIXBuilderParameters certPathBuilderParams = new PKIXBuilderParameters(trustAnchors, certSelector);
        certPathBuilderParams.addCertStore(certStore);
        certPathBuilderParams.setRevocationEnabled(false);
        CertPathBuilderResult result = certPathBuilder.build(certPathBuilderParams);

        // get and show cert path
        CertPath certPath = result.getCertPath();
//        System.out.println(certPath.toString());
    }
项目:openjdk-jdk10    文件:BuildOddSel.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in building
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:openjdk-jdk10    文件:ValidateNC.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in the build
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX", "SUN");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:openjdk9    文件:NoExtensions.java   
private void doBuild(X509Certificate userCert) throws Exception {
        // get the set of trusted CA certificates (only one in this instance)
        HashSet trustAnchors = new HashSet();
        X509Certificate trustedCert = getTrustedCertificate();
        trustAnchors.add(new TrustAnchor(trustedCert, null));

        // put together a CertStore (repository of the certificates and CRLs)
        ArrayList certs = new ArrayList();
        certs.add(trustedCert);
        certs.add(userCert);
        CollectionCertStoreParameters certStoreParams = new CollectionCertStoreParameters(certs);
        CertStore certStore = CertStore.getInstance("Collection", certStoreParams);

        // specify the target certificate via a CertSelector
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setCertificate(userCert);
        certSelector.setSubject(userCert.getSubjectDN().getName()); // seems to be required

        // build a valid cerificate path
        CertPathBuilder certPathBuilder = CertPathBuilder.getInstance("PKIX", "SUN");
        PKIXBuilderParameters certPathBuilderParams = new PKIXBuilderParameters(trustAnchors, certSelector);
        certPathBuilderParams.addCertStore(certStore);
        certPathBuilderParams.setRevocationEnabled(false);
        CertPathBuilderResult result = certPathBuilder.build(certPathBuilderParams);

        // get and show cert path
        CertPath certPath = result.getCertPath();
//        System.out.println(certPath.toString());
    }
项目:openjdk9    文件:BuildOddSel.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in building
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:openjdk9    文件:ValidateNC.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in the build
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX", "SUN");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:jdk8u_jdk    文件:NoExtensions.java   
private void doBuild(X509Certificate userCert) throws Exception {
        // get the set of trusted CA certificates (only one in this instance)
        HashSet trustAnchors = new HashSet();
        X509Certificate trustedCert = getTrustedCertificate();
        trustAnchors.add(new TrustAnchor(trustedCert, null));

        // put together a CertStore (repository of the certificates and CRLs)
        ArrayList certs = new ArrayList();
        certs.add(trustedCert);
        certs.add(userCert);
        CollectionCertStoreParameters certStoreParams = new CollectionCertStoreParameters(certs);
        CertStore certStore = CertStore.getInstance("Collection", certStoreParams);

        // specify the target certificate via a CertSelector
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setCertificate(userCert);
        certSelector.setSubject(userCert.getSubjectDN().getName()); // seems to be required

        // build a valid cerificate path
        CertPathBuilder certPathBuilder = CertPathBuilder.getInstance("PKIX", "SUN");
        PKIXBuilderParameters certPathBuilderParams = new PKIXBuilderParameters(trustAnchors, certSelector);
        certPathBuilderParams.addCertStore(certStore);
        certPathBuilderParams.setRevocationEnabled(false);
        CertPathBuilderResult result = certPathBuilder.build(certPathBuilderParams);

        // get and show cert path
        CertPath certPath = result.getCertPath();
//        System.out.println(certPath.toString());
    }
项目:jdk8u_jdk    文件:BuildOddSel.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in building
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:jdk8u_jdk    文件:ValidateNC.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in the build
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX", "SUN");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:lookaside_java-1.8.0-openjdk    文件:NoExtensions.java   
private void doBuild(X509Certificate userCert) throws Exception {
        // get the set of trusted CA certificates (only one in this instance)
        HashSet trustAnchors = new HashSet();
        X509Certificate trustedCert = getTrustedCertificate();
        trustAnchors.add(new TrustAnchor(trustedCert, null));

        // put together a CertStore (repository of the certificates and CRLs)
        ArrayList certs = new ArrayList();
        certs.add(trustedCert);
        certs.add(userCert);
        CollectionCertStoreParameters certStoreParams = new CollectionCertStoreParameters(certs);
        CertStore certStore = CertStore.getInstance("Collection", certStoreParams);

        // specify the target certificate via a CertSelector
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setCertificate(userCert);
        certSelector.setSubject(userCert.getSubjectDN().getName()); // seems to be required

        // build a valid cerificate path
        CertPathBuilder certPathBuilder = CertPathBuilder.getInstance("PKIX", "SUN");
        PKIXBuilderParameters certPathBuilderParams = new PKIXBuilderParameters(trustAnchors, certSelector);
        certPathBuilderParams.addCertStore(certStore);
        certPathBuilderParams.setRevocationEnabled(false);
        CertPathBuilderResult result = certPathBuilder.build(certPathBuilderParams);

        // get and show cert path
        CertPath certPath = result.getCertPath();
//        System.out.println(certPath.toString());
    }
项目:lookaside_java-1.8.0-openjdk    文件:BuildOddSel.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in building
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:lookaside_java-1.8.0-openjdk    文件:ValidateNC.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in the build
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX", "SUN");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:infobip-open-jdk-8    文件:NoExtensions.java   
private void doBuild(X509Certificate userCert) throws Exception {
        // get the set of trusted CA certificates (only one in this instance)
        HashSet trustAnchors = new HashSet();
        X509Certificate trustedCert = getTrustedCertificate();
        trustAnchors.add(new TrustAnchor(trustedCert, null));

        // put together a CertStore (repository of the certificates and CRLs)
        ArrayList certs = new ArrayList();
        certs.add(trustedCert);
        certs.add(userCert);
        CollectionCertStoreParameters certStoreParams = new CollectionCertStoreParameters(certs);
        CertStore certStore = CertStore.getInstance("Collection", certStoreParams);

        // specify the target certificate via a CertSelector
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setCertificate(userCert);
        certSelector.setSubject(userCert.getSubjectDN().getName()); // seems to be required

        // build a valid cerificate path
        CertPathBuilder certPathBuilder = CertPathBuilder.getInstance("PKIX", "SUN");
        PKIXBuilderParameters certPathBuilderParams = new PKIXBuilderParameters(trustAnchors, certSelector);
        certPathBuilderParams.addCertStore(certStore);
        certPathBuilderParams.setRevocationEnabled(false);
        CertPathBuilderResult result = certPathBuilder.build(certPathBuilderParams);

        // get and show cert path
        CertPath certPath = result.getCertPath();
//        System.out.println(certPath.toString());
    }
项目:infobip-open-jdk-8    文件:BuildOddSel.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in building
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:infobip-open-jdk-8    文件:ValidateNC.java   
/**
 * Perform a PKIX build.
 *
 * @param params PKIXBuilderParameters to use in the build
 * @throws Exception on error
 */
public static void build(PKIXBuilderParameters params)
    throws Exception {
    CertPathBuilder builder =
        CertPathBuilder.getInstance("PKIX", "SUN");
    CertPathBuilderResult cpbr = builder.build(params);
}
项目:jdk8u-dev-jdk    文件:NoExtensions.java   
private void doBuild(X509Certificate userCert) throws Exception {
        // get the set of trusted CA certificates (only one in this instance)
        HashSet trustAnchors = new HashSet();
        X509Certificate trustedCert = getTrustedCertificate();
        trustAnchors.add(new TrustAnchor(trustedCert, null));

        // put together a CertStore (repository of the certificates and CRLs)
        ArrayList certs = new ArrayList();
        certs.add(trustedCert);
        certs.add(userCert);
        CollectionCertStoreParameters certStoreParams = new CollectionCertStoreParameters(certs);
        CertStore certStore = CertStore.getInstance("Collection", certStoreParams);

        // specify the target certificate via a CertSelector
        X509CertSelector certSelector = new X509CertSelector();
        certSelector.setCertificate(userCert);
        certSelector.setSubject(userCert.getSubjectDN().getName()); // seems to be required

        // build a valid cerificate path
        CertPathBuilder certPathBuilder = CertPathBuilder.getInstance("PKIX", "SUN");
        PKIXBuilderParameters certPathBuilderParams = new PKIXBuilderParameters(trustAnchors, certSelector);
        certPathBuilderParams.addCertStore(certStore);
        certPathBuilderParams.setRevocationEnabled(false);
        CertPathBuilderResult result = certPathBuilder.build(certPathBuilderParams);

        // get and show cert path
        CertPath certPath = result.getCertPath();
//        System.out.println(certPath.toString());
    }