author | ascarpino |
Wed, 08 Feb 2017 12:08:28 -0800 | |
changeset 43701 | fe8c324ba97c |
parent 39465 | 8c06651d9138 |
child 44158 | 49deb8a1ed3f |
permissions | -rw-r--r-- |
2 | 1 |
/* |
43701
fe8c324ba97c
8160655: Fix denyAfter and usage types for security properties
ascarpino
parents:
39465
diff
changeset
|
2 |
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.security.provider.certpath; |
|
27 |
||
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
28 |
import java.io.IOException; |
2 | 29 |
import java.security.InvalidAlgorithmParameterException; |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
30 |
import java.security.cert.*; |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
31 |
import java.util.*; |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
32 |
|
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
33 |
import sun.security.provider.certpath.PKIX.ValidatorParams; |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
34 |
import sun.security.x509.X509CertImpl; |
2 | 35 |
import sun.security.util.Debug; |
36 |
||
37 |
/** |
|
38 |
* This class implements the PKIX validation algorithm for certification |
|
39 |
* paths consisting exclusively of <code>X509Certificates</code>. It uses |
|
40 |
* the specified input parameter set (which must be a |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
41 |
* <code>PKIXParameters</code> object). |
2 | 42 |
* |
43 |
* @since 1.4 |
|
44 |
* @author Yassir Elley |
|
45 |
*/ |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
46 |
public final class PKIXCertPathValidator extends CertPathValidatorSpi { |
2 | 47 |
|
48 |
private static final Debug debug = Debug.getInstance("certpath"); |
|
49 |
||
50 |
/** |
|
51 |
* Default constructor. |
|
52 |
*/ |
|
53 |
public PKIXCertPathValidator() {} |
|
54 |
||
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
55 |
@Override |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
56 |
public CertPathChecker engineGetRevocationChecker() { |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
57 |
return new RevocationChecker(); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
58 |
} |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
59 |
|
2 | 60 |
/** |
61 |
* Validates a certification path consisting exclusively of |
|
62 |
* <code>X509Certificate</code>s using the PKIX validation algorithm, |
|
63 |
* which uses the specified input parameter set. |
|
64 |
* The input parameter set must be a <code>PKIXParameters</code> object. |
|
65 |
* |
|
66 |
* @param cp the X509 certification path |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
67 |
* @param params the input PKIX parameter set |
2 | 68 |
* @return the result |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
69 |
* @throws CertPathValidatorException if cert path does not validate. |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
70 |
* @throws InvalidAlgorithmParameterException if the specified |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
71 |
* parameters are inappropriate for this CertPathValidator |
2 | 72 |
*/ |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
73 |
@Override |
2 | 74 |
public CertPathValidatorResult engineValidate(CertPath cp, |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
75 |
CertPathParameters params) |
2 | 76 |
throws CertPathValidatorException, InvalidAlgorithmParameterException |
77 |
{ |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
78 |
ValidatorParams valParams = PKIX.checkParams(cp, params); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
79 |
return validate(valParams); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
80 |
} |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
81 |
|
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
82 |
private static PKIXCertPathValidatorResult validate(ValidatorParams params) |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
83 |
throws CertPathValidatorException |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
84 |
{ |
2 | 85 |
if (debug != null) |
86 |
debug.println("PKIXCertPathValidator.engineValidate()..."); |
|
87 |
||
88 |
// Retrieve the first certificate in the certpath |
|
89 |
// (to be used later in pre-screening) |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
90 |
AdaptableX509CertSelector selector = null; |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
91 |
List<X509Certificate> certList = params.certificates(); |
2 | 92 |
if (!certList.isEmpty()) { |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
93 |
selector = new AdaptableX509CertSelector(); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
94 |
X509Certificate firstCert = certList.get(0); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
95 |
// check trusted certificate's subject |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
96 |
selector.setSubject(firstCert.getIssuerX500Principal()); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
97 |
/* |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
98 |
* Facilitate certification path construction with authority |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
99 |
* key identifier and subject key identifier. |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
100 |
*/ |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
101 |
try { |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
102 |
X509CertImpl firstCertImpl = X509CertImpl.toImpl(firstCert); |
22977
f8f315760941
8025708: Certificate Path Building problem with AKI serial number
mullan
parents:
19045
diff
changeset
|
103 |
selector.setSkiAndSerialNumber( |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
104 |
firstCertImpl.getAuthorityKeyIdentifierExtension()); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
105 |
} catch (CertificateException | IOException e) { |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
106 |
// ignore |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
107 |
} |
2 | 108 |
} |
109 |
||
110 |
CertPathValidatorException lastException = null; |
|
111 |
||
112 |
// We iterate through the set of trust anchors until we find |
|
113 |
// one that works at which time we stop iterating |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
114 |
for (TrustAnchor anchor : params.trustAnchors()) { |
2 | 115 |
X509Certificate trustedCert = anchor.getTrustedCert(); |
116 |
if (trustedCert != null) { |
|
117 |
// if this trust anchor is not worth trying, |
|
118 |
// we move on to the next one |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
119 |
if (selector != null && !selector.match(trustedCert)) { |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
120 |
if (debug != null) { |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
121 |
debug.println("NO - don't try this trustedCert"); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
122 |
} |
2 | 123 |
continue; |
124 |
} |
|
125 |
||
126 |
if (debug != null) { |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
127 |
debug.println("YES - try this trustedCert"); |
2 | 128 |
debug.println("anchor.getTrustedCert()." |
129 |
+ "getSubjectX500Principal() = " |
|
130 |
+ trustedCert.getSubjectX500Principal()); |
|
131 |
} |
|
132 |
} else { |
|
133 |
if (debug != null) { |
|
134 |
debug.println("PKIXCertPathValidator.engineValidate(): " |
|
135 |
+ "anchor.getTrustedCert() == null"); |
|
136 |
} |
|
137 |
} |
|
138 |
||
139 |
try { |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
140 |
return validate(anchor, params); |
2 | 141 |
} catch (CertPathValidatorException cpe) { |
142 |
// remember this exception |
|
143 |
lastException = cpe; |
|
144 |
} |
|
145 |
} |
|
146 |
||
147 |
// could not find a trust anchor that verified |
|
148 |
// (a) if we did a validation and it failed, use that exception |
|
149 |
if (lastException != null) { |
|
150 |
throw lastException; |
|
151 |
} |
|
152 |
// (b) otherwise, generate new exception |
|
153 |
throw new CertPathValidatorException |
|
1238
6d1f4b722acd
6465942: Add problem identification facility to the CertPathValidator framework
mullan
parents:
2
diff
changeset
|
154 |
("Path does not chain with any of the trust anchors", |
6d1f4b722acd
6465942: Add problem identification facility to the CertPathValidator framework
mullan
parents:
2
diff
changeset
|
155 |
null, null, -1, PKIXReason.NO_TRUST_ANCHOR); |
2 | 156 |
} |
157 |
||
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
158 |
private static PKIXCertPathValidatorResult validate(TrustAnchor anchor, |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
159 |
ValidatorParams params) |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
160 |
throws CertPathValidatorException |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
161 |
{ |
31688
42c9b194a469
8073894: Getting to the root of certificate chains
mullan
parents:
25859
diff
changeset
|
162 |
// check if anchor is untrusted |
42c9b194a469
8073894: Getting to the root of certificate chains
mullan
parents:
25859
diff
changeset
|
163 |
UntrustedChecker untrustedChecker = new UntrustedChecker(); |
42c9b194a469
8073894: Getting to the root of certificate chains
mullan
parents:
25859
diff
changeset
|
164 |
X509Certificate anchorCert = anchor.getTrustedCert(); |
42c9b194a469
8073894: Getting to the root of certificate chains
mullan
parents:
25859
diff
changeset
|
165 |
if (anchorCert != null) { |
42c9b194a469
8073894: Getting to the root of certificate chains
mullan
parents:
25859
diff
changeset
|
166 |
untrustedChecker.check(anchorCert); |
42c9b194a469
8073894: Getting to the root of certificate chains
mullan
parents:
25859
diff
changeset
|
167 |
} |
42c9b194a469
8073894: Getting to the root of certificate chains
mullan
parents:
25859
diff
changeset
|
168 |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
169 |
int certPathLen = params.certificates().size(); |
8163
d9bcc1208691
7011497: new CertPathValidatorException.BasicReason enum constant for constrained algorithm
xuelei
parents:
7040
diff
changeset
|
170 |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
171 |
// create PKIXCertPathCheckers |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
172 |
List<PKIXCertPathChecker> certPathCheckers = new ArrayList<>(); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
173 |
// add standard checkers that we will be using |
31688
42c9b194a469
8073894: Getting to the root of certificate chains
mullan
parents:
25859
diff
changeset
|
174 |
certPathCheckers.add(untrustedChecker); |
39465
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
175 |
if (params.timestamp() == null) { |
43701
fe8c324ba97c
8160655: Fix denyAfter and usage types for security properties
ascarpino
parents:
39465
diff
changeset
|
176 |
certPathCheckers.add(new AlgorithmChecker(anchor, params.date(), null)); |
39465
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
177 |
} else { |
43701
fe8c324ba97c
8160655: Fix denyAfter and usage types for security properties
ascarpino
parents:
39465
diff
changeset
|
178 |
certPathCheckers.add(new AlgorithmChecker(null, |
fe8c324ba97c
8160655: Fix denyAfter and usage types for security properties
ascarpino
parents:
39465
diff
changeset
|
179 |
params.timestamp(), params.variant())); |
39465
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
180 |
} |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
181 |
certPathCheckers.add(new KeyChecker(certPathLen, |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
182 |
params.targetCertConstraints())); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
183 |
certPathCheckers.add(new ConstraintsChecker(certPathLen)); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
184 |
PolicyNodeImpl rootNode = |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
185 |
new PolicyNodeImpl(null, PolicyChecker.ANY_POLICY, null, false, |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
186 |
Collections.singleton(PolicyChecker.ANY_POLICY), |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
187 |
false); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
188 |
PolicyChecker pc = new PolicyChecker(params.initialPolicies(), |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
189 |
certPathLen, |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
190 |
params.explicitPolicyRequired(), |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
191 |
params.policyMappingInhibited(), |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
192 |
params.anyPolicyInhibited(), |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
193 |
params.policyQualifiersRejected(), |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
194 |
rootNode); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
195 |
certPathCheckers.add(pc); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
196 |
// default value for date is current time |
39465
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
197 |
BasicChecker bc; |
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
198 |
if (params.timestamp() == null) { |
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
199 |
bc = new BasicChecker(anchor, params.date(), params.sigProvider(), |
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
200 |
false); |
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
201 |
} else { |
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
202 |
bc = new BasicChecker(anchor, params.timestamp().getTimestamp(), |
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
203 |
params.sigProvider(), false); |
8c06651d9138
8154015: Apply algorithm constraints to timestamped code
ascarpino
parents:
38576
diff
changeset
|
204 |
} |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
205 |
certPathCheckers.add(bc); |
2 | 206 |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
207 |
boolean revCheckerAdded = false; |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
208 |
List<PKIXCertPathChecker> checkers = params.certPathCheckers(); |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
209 |
for (PKIXCertPathChecker checker : checkers) { |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
210 |
if (checker instanceof PKIXRevocationChecker) { |
19045
bc9a25fff6c5
8010748: Add PKIXRevocationChecker NO_FALLBACK option and improve SOFT_FAIL option
mullan
parents:
12861
diff
changeset
|
211 |
if (revCheckerAdded) { |
bc9a25fff6c5
8010748: Add PKIXRevocationChecker NO_FALLBACK option and improve SOFT_FAIL option
mullan
parents:
12861
diff
changeset
|
212 |
throw new CertPathValidatorException( |
bc9a25fff6c5
8010748: Add PKIXRevocationChecker NO_FALLBACK option and improve SOFT_FAIL option
mullan
parents:
12861
diff
changeset
|
213 |
"Only one PKIXRevocationChecker can be specified"); |
bc9a25fff6c5
8010748: Add PKIXRevocationChecker NO_FALLBACK option and improve SOFT_FAIL option
mullan
parents:
12861
diff
changeset
|
214 |
} |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
215 |
revCheckerAdded = true; |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
216 |
// if it's our own, initialize it |
19045
bc9a25fff6c5
8010748: Add PKIXRevocationChecker NO_FALLBACK option and improve SOFT_FAIL option
mullan
parents:
12861
diff
changeset
|
217 |
if (checker instanceof RevocationChecker) { |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
218 |
((RevocationChecker)checker).init(anchor, params); |
19045
bc9a25fff6c5
8010748: Add PKIXRevocationChecker NO_FALLBACK option and improve SOFT_FAIL option
mullan
parents:
12861
diff
changeset
|
219 |
} |
8163
d9bcc1208691
7011497: new CertPathValidatorException.BasicReason enum constant for constrained algorithm
xuelei
parents:
7040
diff
changeset
|
220 |
} |
2 | 221 |
} |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
222 |
// only add a RevocationChecker if revocation is enabled and |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
223 |
// a PKIXRevocationChecker has not already been added |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
224 |
if (params.revocationEnabled() && !revCheckerAdded) { |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
225 |
certPathCheckers.add(new RevocationChecker(anchor, params)); |
2 | 226 |
} |
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
227 |
// add user-specified checkers |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
228 |
certPathCheckers.addAll(checkers); |
2 | 229 |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
230 |
PKIXMasterCertPathValidator.validate(params.certPath(), |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
231 |
params.certificates(), |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
232 |
certPathCheckers); |
2 | 233 |
|
12860
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
234 |
return new PKIXCertPathValidatorResult(anchor, pc.getPolicyTree(), |
9ffbd4e43413
6854712: Revocation checking enhancements (JEP-124)
mullan
parents:
10336
diff
changeset
|
235 |
bc.getPublicKey()); |
2 | 236 |
} |
237 |
} |