本文整理汇总了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;
}
示例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);
}
示例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;
}
示例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);
}
示例5: PKIXTimestampParameters
import java.security.cert.PKIXBuilderParameters; //导入方法依赖的package包/类
public PKIXTimestampParameters(PKIXBuilderParameters params,
Timestamp timestamp) throws InvalidAlgorithmParameterException {
super(params.getTrustAnchors(), null);
p = params;
jarTimestamp = timestamp;
}