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


Java PKIXParameters.getCertPathCheckers方法代碼示例

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


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

示例1: populateVariables

import java.security.cert.PKIXParameters; //導入方法依賴的package包/類
/**
 * Internal method to setup the internal state
 */
private void populateVariables(PKIXParameters pkixParam)
{
    // default value for testDate is current time
    testDate = pkixParam.getDate();
    if (testDate == null) {
        testDate = new Date(System.currentTimeMillis());
    }

    userCheckers = pkixParam.getCertPathCheckers();
    sigProvider = pkixParam.getSigProvider();

    if (pkixParam.isRevocationEnabled()) {
        // Examine OCSP security property
        ocspEnabled = AccessController.doPrivileged(
            new GetBooleanSecurityPropertyAction
                (OCSPChecker.OCSP_ENABLE_PROP));
        onlyEECert = AccessController.doPrivileged(
            new GetBooleanSecurityPropertyAction
                ("com.sun.security.onlyCheckRevocationOfEECert"));
    }
}
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:25,代碼來源:PKIXCertPathValidator.java

示例2: testGetCertPathCheckers02

import java.security.cert.PKIXParameters; //導入方法依賴的package包/類
/**
 * Test #2 for <code>getCertPathCheckers()</code> method<br>
 * Assertion: returns an immutable <code>List</code>
 * of <code>PKIXCertPathChecker</code>s
 * @throws InvalidAlgorithmParameterException
 */
public final void testGetCertPathCheckers02() throws Exception {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }

    PKIXParameters p = new PKIXParameters(taSet);
    List l = p.getCertPathCheckers();

    try {
        // try to modify returned list
        l.add(new Object());
        fail("must be immutable");
    } catch (Exception e) {
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:23,代碼來源:PKIXParametersTest.java

示例3: testSetCertPathCheckers01

import java.security.cert.PKIXParameters; //導入方法依賴的package包/類
/**
 * Test #1 for <code>setCertPathCheckers(List)</code> method<br>
 * Assertion: sets a <code>List</code> of additional
 * certification path checkers
 * @throws InvalidAlgorithmParameterException
 */
public final void testSetCertPathCheckers01() throws Exception {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }

    PKIXParameters p = new PKIXParameters(taSet);
    PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
    List l = new ArrayList();
    assertTrue("addedOk", l.add(cpc));
    p.setCertPathCheckers(l);
    List l1 = p.getCertPathCheckers();
    assertNotNull("notNull", l1);
    assertFalse("isNotEmpty", l1.isEmpty());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:22,代碼來源:PKIXParametersTest.java

示例4: testSetCertPathCheckers02

import java.security.cert.PKIXParameters; //導入方法依賴的package包/類
/**
 * Test #2 for <code>setCertPathCheckers(List)</code> method<br>
 * Assertion: <code>List</code> ... may be null
 * @throws InvalidAlgorithmParameterException
 */
public final void testSetCertPathCheckers02() throws Exception {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }

    PKIXParameters p = new PKIXParameters(taSet);
    p.setCertPathCheckers(null);
    List l1 = p.getCertPathCheckers();
    assertNotNull("notNull1", l1);
    assertTrue("isEmpty1", l1.isEmpty());
    p.setCertPathCheckers(new ArrayList());
    List l2 = p.getCertPathCheckers();
    assertNotNull("notNull2", l2);
    assertTrue("isEmpty2", l2.isEmpty());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:22,代碼來源:PKIXParametersTest.java

示例5: testAddCertPathChecker01

import java.security.cert.PKIXParameters; //導入方法依賴的package包/類
/**
 * Test #1 for <code>addCertPathChecker(PKIXCertPathChecker)</code> method<br>
 * Assertion: adds a <code>CertPathChecker</code> to the end of the
 * list of <code>CertPathChecker</code>s 
 * @throws CertPathValidatorException
 */
public final void testAddCertPathChecker01() throws Exception {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }

    PKIXParameters p = new PKIXParameters(taSet);
    PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
    List l = new ArrayList();
    assertTrue("addedOk", l.add(cpc));
    p.setCertPathCheckers(l);
    // create one more PKIXCertPathChecker
    PKIXCertPathChecker cpc1 = TestUtils.getTestCertPathChecker();
    cpc1.init(true);
    p.addCertPathChecker(cpc1);
    // check that we have two PKIXCertPathCheckers and
    // they are in right order
    List l1 = p.getCertPathCheckers();
    assertEquals("listSize", 2, l1.size());
    assertFalse("order1",
            ((PKIXCertPathChecker)l1.get(0)).isForwardCheckingSupported());
    assertTrue("order2",
            ((PKIXCertPathChecker)l1.get(1)).isForwardCheckingSupported());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:31,代碼來源:PKIXParametersTest.java

示例6: testAddCertPathChecker02

import java.security.cert.PKIXParameters; //導入方法依賴的package包/類
/**
 * Test #2 for <code>addCertPathChecker(PKIXCertPathChecker)</code> method<br>
 * Assertion: if null, the checker is ignored (not added to list).
 * @throws InvalidAlgorithmParameterException
 */
public final void testAddCertPathChecker02() throws Exception {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }

    PKIXParameters p = new PKIXParameters(taSet);
    PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();
    List l = new ArrayList();
    assertTrue("addedOk", l.add(cpc));
    p.setCertPathCheckers(l);
    // try to add null
    p.addCertPathChecker(null);
    // check that we have one PKIXCertPathChecker
    List l1 = p.getCertPathCheckers();
    assertEquals("listSize", 1, l1.size());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:23,代碼來源:PKIXParametersTest.java

示例7: testAddCertPathChecker03

import java.security.cert.PKIXParameters; //導入方法依賴的package包/類
/**
 * Test #3 for <code>addCertPathChecker(PKIXCertPathChecker)</code> method<br>
 * Assertion: <code>PKIXCertPathChecker</code> is cloned to protect
 * against subsequent modifications
 * @throws InvalidAlgorithmParameterException
 * @throws CertPathValidatorException
 */
public final void testAddCertPathChecker03() throws Exception {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }

    // checks that checkers cloned
    PKIXParameters p = new PKIXParameters(taSet);
    PKIXCertPathChecker cpc = TestUtils.getTestCertPathChecker();

    p.addCertPathChecker(cpc);
    // modify checker
    cpc.init(true);
    // retrieve list and check that CertPathChecker's
    // state it contains has not been changed by the
    // above modification
    List l = p.getCertPathCheckers();
    PKIXCertPathChecker cpc1 = (PKIXCertPathChecker)l.get(0);
    assertEquals("listSize", 1, l.size());
    assertFalse("isCopied", cpc1.isForwardCheckingSupported());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:29,代碼來源:PKIXParametersTest.java

示例8: testGetCertPathCheckers01

import java.security.cert.PKIXParameters; //導入方法依賴的package包/類
/**
 * Test #1 for <code>getCertPathCheckers()</code> method<br>
 * Assertion: list ... may be empty, but not <code>null</code>
 * @throws InvalidAlgorithmParameterException
 */
public final void testGetCertPathCheckers01() throws Exception {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }

    PKIXParameters p = new PKIXParameters(taSet);
    List l = p.getCertPathCheckers();
    assertNotNull("notNull", l);
    assertTrue("isEmpty",l.isEmpty());
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:17,代碼來源:PKIXParametersTest.java


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