本文整理汇总了Java中java.security.cert.PKIXCertPathChecker.init方法的典型用法代码示例。如果您正苦于以下问题:Java PKIXCertPathChecker.init方法的具体用法?Java PKIXCertPathChecker.init怎么用?Java PKIXCertPathChecker.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.security.cert.PKIXCertPathChecker
的用法示例。
在下文中一共展示了PKIXCertPathChecker.init方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initState
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的package包/类
/**
* Initialize the state.
*
* @param certPathCheckers the list of user-defined PKIXCertPathCheckers
*/
public void initState(List<PKIXCertPathChecker> certPathCheckers)
throws CertPathValidatorException
{
subjectNamesTraversed = new HashSet<GeneralNameInterface>();
traversedCACerts = 0;
/*
* Populate forwardCheckers with every user-defined checker
* that supports forward checking and initialize the forwardCheckers
*/
forwardCheckers = new ArrayList<PKIXCertPathChecker>();
for (PKIXCertPathChecker checker : certPathCheckers) {
if (checker.isForwardCheckingSupported()) {
checker.init(true);
forwardCheckers.add(checker);
}
}
init = true;
}
示例2: initState
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的package包/类
/**
* Initialize the state.
*
* @param certPathCheckers the list of user-defined PKIXCertPathCheckers
*/
public void initState(List<PKIXCertPathChecker> certPathCheckers)
throws CertPathValidatorException
{
subjectNamesTraversed = new HashSet<GeneralNameInterface>();
traversedCACerts = 0;
/*
* Populate forwardCheckers with every user-defined checker
* that supports forward checking and initialize the forwardCheckers
*/
forwardCheckers = new ArrayList<PKIXCertPathChecker>();
if (certPathCheckers != null) {
for (PKIXCertPathChecker checker : certPathCheckers) {
if (checker.isForwardCheckingSupported()) {
checker.init(true);
forwardCheckers.add(checker);
}
}
}
init = true;
}
示例3: testGetCertPathCheckers03
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的package包/类
/**
* Test #3 for <code>getCertPathCheckers()</code> method<br>
* Assertion: The returned List is immutable, and each
* <code>PKIXCertPathChecker</code> in the <code>List</code>
* is cloned to protect against subsequent modifications
* @throws InvalidAlgorithmParameterException
* @throws CertPathValidatorException
*/
public final void testGetCertPathCheckers03() 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);
// retrieve checker and modify it
PKIXCertPathChecker cpc1 = p.getCertPathCheckers().get(0);
cpc1.init(true);
assertTrue("modifiedOk", cpc1.isForwardCheckingSupported());
// retrieve checker again and check
// that its state has not been changed
// by the above modification
PKIXCertPathChecker cpc2 = p.getCertPathCheckers().get(0);
assertFalse("isCloned", cpc2.isForwardCheckingSupported());
}
示例4: testSetCertPathCheckers04
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的package包/类
/**
* Test #4 for <code>setCertPathCheckers(List)</code> method<br>
* Assertion: <code>List</code> supplied here is copied and each
* <code>PKIXCertPathChecker</code> in the list is cloned to protect
* against subsequent modifications
* @throws InvalidAlgorithmParameterException
* @throws InvalidAlgorithmParameterException
* @throws CertPathValidatorException
*/
public final void testSetCertPathCheckers04() throws Exception {
// checks that checkers cloned
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);
// modify checker
cpc.init(true);
// retrieve list and check that CertPathChecker's
// state it contains has not been changed by the
// above modification
PKIXCertPathChecker cpc1 = p.getCertPathCheckers().get(0);
assertFalse("isCopied", cpc1.isForwardCheckingSupported());
}
示例5: testAddCertPathChecker01
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的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());
}
示例6: testAddCertPathChecker03
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的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());
}
示例7: testInit
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的package包/类
@TestTargetNew(
level = TestLevel.COMPLETE,
notes = "",
method = "init",
args = {boolean.class}
)
public final void testInit()
throws CertPathValidatorException {
PKIXCertPathChecker pc = TestUtils.getTestCertPathChecker();
pc.init(true);
}
示例8: initState
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的package包/类
/**
* Initialize the state.
*
* @param buildParams builder parameters
*/
public void initState(BuilderParams buildParams)
throws CertPathValidatorException
{
/*
* Initialize number of remainingCACerts.
* Note that -1 maxPathLen implies unlimited.
* 0 implies only an EE cert is acceptable.
*/
int maxPathLen = buildParams.maxPathLength();
remainingCACerts = (maxPathLen == -1) ? Integer.MAX_VALUE
: maxPathLen;
/* Initialize explicit policy state variable */
if (buildParams.explicitPolicyRequired()) {
explicitPolicy = 0;
} else {
// unconstrained if maxPathLen is -1,
// otherwise, we want to initialize this to the value of the
// longest possible path + 1 (i.e. maxpathlen + finalcert + 1)
explicitPolicy = (maxPathLen == -1) ? maxPathLen : maxPathLen + 2;
}
/* Initialize policy mapping state variable */
if (buildParams.policyMappingInhibited()) {
policyMapping = 0;
} else {
policyMapping = (maxPathLen == -1) ? maxPathLen : maxPathLen + 2;
}
/* Initialize inhibit any policy state variable */
if (buildParams.anyPolicyInhibited()) {
inhibitAnyPolicy = 0;
} else {
inhibitAnyPolicy = (maxPathLen == -1) ? maxPathLen : maxPathLen + 2;
}
/* Initialize certIndex */
certIndex = 1;
/* Initialize policy tree */
Set<String> initExpPolSet = new HashSet<>(1);
initExpPolSet.add(PolicyChecker.ANY_POLICY);
rootNode = new PolicyNodeImpl(null, PolicyChecker.ANY_POLICY, null,
false, initExpPolSet, false);
/*
* Initialize each user-defined checker
* Shallow copy the checkers
*/
userCheckers = new ArrayList<>(buildParams.certPathCheckers());
/* initialize each checker (just in case) */
for (PKIXCertPathChecker checker : userCheckers) {
checker.init(false);
}
/* Start by trusting the cert to sign CRLs */
crlSign = true;
init = true;
}
示例9: initState
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的package包/类
/**
* Initialize the state.
*
* @param maxPathLen The maximum number of CA certs in a path, where -1
* means unlimited and 0 means only a single EE cert is allowed.
* @param explicitPolicyRequired True, if explicit policy is required.
* @param policyMappingInhibited True, if policy mapping is inhibited.
* @param anyPolicyInhibited True, if any policy is inhibited.
* @param certPathCheckers the list of user-defined PKIXCertPathCheckers
*/
public void initState(int maxPathLen, boolean explicitPolicyRequired,
boolean policyMappingInhibited, boolean anyPolicyInhibited,
List<PKIXCertPathChecker> certPathCheckers)
throws CertPathValidatorException
{
/*
* Initialize number of remainingCACerts.
* Note that -1 maxPathLen implies unlimited.
* 0 implies only an EE cert is acceptable.
*/
remainingCACerts = (maxPathLen == -1 ? Integer.MAX_VALUE : maxPathLen);
/* Initialize explicit policy state variable */
if (explicitPolicyRequired) {
explicitPolicy = 0;
} else {
// unconstrained if maxPathLen is -1,
// otherwise, we want to initialize this to the value of the
// longest possible path + 1 (i.e. maxpathlen + finalcert + 1)
explicitPolicy = (maxPathLen == -1)
? maxPathLen
: maxPathLen + 2;
}
/* Initialize policy mapping state variable */
if (policyMappingInhibited) {
policyMapping = 0;
} else {
policyMapping = (maxPathLen == -1)
? maxPathLen
: maxPathLen + 2;
}
/* Initialize inhibit any policy state variable */
if (anyPolicyInhibited) {
inhibitAnyPolicy = 0;
} else {
inhibitAnyPolicy = (maxPathLen == -1)
? maxPathLen
: maxPathLen + 2;
}
/* Initialize certIndex */
certIndex = 1;
/* Initialize policy tree */
Set<String> initExpPolSet = new HashSet<String>(1);
initExpPolSet.add(PolicyChecker.ANY_POLICY);
rootNode = new PolicyNodeImpl
(null, PolicyChecker.ANY_POLICY, null, false, initExpPolSet, false);
/*
* Initialize each user-defined checker
*/
if (certPathCheckers != null) {
/* Shallow copy the checkers */
userCheckers = new ArrayList<PKIXCertPathChecker>(certPathCheckers);
/* initialize each checker (just in case) */
for (PKIXCertPathChecker checker : certPathCheckers) {
checker.init(false);
}
} else {
userCheckers = new ArrayList<PKIXCertPathChecker>();
}
/* Start by trusting the cert to sign CRLs */
crlSign = true;
init = true;
}
示例10: testInit
import java.security.cert.PKIXCertPathChecker; //导入方法依赖的package包/类
public final void testInit()
throws CertPathValidatorException {
PKIXCertPathChecker pc = TestUtils.getTestCertPathChecker();
pc.init(true);
}