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


Java PKIXBuilderParameters.getTrustAnchors方法代碼示例

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


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

示例1: ForwardBuilder

import java.security.cert.PKIXBuilderParameters; //導入方法依賴的package包/類
/**
 * Initialize the builder with the input parameters.
 *
 * @param params the parameter set used to build a certification path
 */
ForwardBuilder(PKIXBuilderParameters buildParams,
    X500Principal targetSubjectDN, boolean searchAllCertStores,
    boolean onlyEECert)
{
    super(buildParams, targetSubjectDN);

    // populate sets of trusted certificates and subject DNs
    trustAnchors = buildParams.getTrustAnchors();
    trustedCerts = new HashSet<X509Certificate>(trustAnchors.size());
    trustedSubjectDNs = new HashSet<X500Principal>(trustAnchors.size());
    for (TrustAnchor anchor : trustAnchors) {
        X509Certificate trustedCert = anchor.getTrustedCert();
        if (trustedCert != null) {
            trustedCerts.add(trustedCert);
            trustedSubjectDNs.add(trustedCert.getSubjectX500Principal());
        } else {
            trustedSubjectDNs.add(anchor.getCA());
        }
    }
    comparator = new PKIXCertComparator(trustedSubjectDNs);
    this.searchAllCertStores = searchAllCertStores;
    this.onlyEECert = onlyEECert;
}
 
開發者ID:openjdk,項目名稱:jdk7-jdk,代碼行數:29,代碼來源:ForwardBuilder.java

示例2: testPKIXBuilderParametersSetCertSelector03

import java.security.cert.PKIXBuilderParameters; //導入方法依賴的package包/類
/**
 * Test #3 for <code>PKIXBuilderParameters(Set, CertSelector)</code>
 * constructor<br>
 * Assertion: ... the <code>Set</code> is copied to protect against
 * subsequent modifications
 * @throws InvalidAlgorithmParameterException
 */
public final void testPKIXBuilderParametersSetCertSelector03()
    throws InvalidAlgorithmParameterException {
    Set taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }
    HashSet originalSet = (HashSet)taSet;
    HashSet originalSetCopy = (HashSet)originalSet.clone();
    // create test object using originalSet 
    PKIXBuilderParameters pp =
        new PKIXBuilderParameters(originalSetCopy, null);
    // modify originalSet
    originalSetCopy.clear();
    // check that test object's internal state
    // has not been affected by the above modification
    Set returnedSet = pp.getTrustAnchors();
    assertEquals(originalSet, returnedSet);
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:26,代碼來源:PKIXBuilderParametersTest.java

示例3: PKIXExtendedParameters

import java.security.cert.PKIXBuilderParameters; //導入方法依賴的package包/類
public PKIXExtendedParameters(PKIXBuilderParameters params,
        Timestamp timestamp, String variant)
        throws InvalidAlgorithmParameterException {
    super(params.getTrustAnchors(), null);
    p = params;
    jarTimestamp = timestamp;
    this.variant = variant;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:9,代碼來源:PKIXExtendedParameters.java

示例4: testPKIXBuilderParametersSetCertSelector03

import java.security.cert.PKIXBuilderParameters; //導入方法依賴的package包/類
/**
 * Test #3 for <code>PKIXBuilderParameters(Set, CertSelector)</code>
 * constructor<br>
 * Assertion: ... the <code>Set</code> is copied to protect against
 * subsequent modifications
 * @throws InvalidAlgorithmParameterException
 */
@TestTargetNew(
    level = TestLevel.PARTIAL_COMPLETE,
    notes = "Verifies null as a CertSelector parameter.",
    method = "PKIXBuilderParameters",
    args = {java.util.Set.class, java.security.cert.CertSelector.class}
)
@SuppressWarnings("unchecked")
public final void testPKIXBuilderParametersSetCertSelector03()
    throws InvalidAlgorithmParameterException {
    Set<TrustAnchor> taSet = TestUtils.getTrustAnchorSet();
    if (taSet == null) {
        fail(getName() + ": not performed (could not create test TrustAnchor set)");
    }
    HashSet<TrustAnchor> originalSet = (HashSet<TrustAnchor>) taSet;
    HashSet<TrustAnchor> originalSetCopy = (HashSet<TrustAnchor>) originalSet
            .clone();
    // create test object using originalSet
    PKIXBuilderParameters pp =
        new PKIXBuilderParameters(originalSetCopy, null);
    // modify originalSet
    originalSetCopy.clear();
    // check that test object's internal state
    // has not been affected by the above modification
    Set returnedSet = pp.getTrustAnchors();
    assertEquals(originalSet, returnedSet);
}
 
開發者ID:keplersj,項目名稱:In-the-Box-Fork,代碼行數:34,代碼來源:PKIXBuilderParametersTest.java

示例5: PKIXTimestampParameters

import java.security.cert.PKIXBuilderParameters; //導入方法依賴的package包/類
public PKIXTimestampParameters(PKIXBuilderParameters params,
        Timestamp timestamp) throws InvalidAlgorithmParameterException {
    super(params.getTrustAnchors(), null);
    p = params;
    jarTimestamp = timestamp;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:7,代碼來源:PKIXTimestampParameters.java


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