author | vinnie |
Wed, 14 May 2008 18:59:18 +0100 | |
changeset 625 | ba0b63c29671 |
parent 2 | 90ce3da70b43 |
child 715 | f16baef3a20e |
permissions | -rw-r--r-- |
2 | 1 |
/* |
2 |
* Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. |
|
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 |
|
7 |
* published by the Free Software Foundation. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
|
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 |
* |
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
package sun.security.provider.certpath; |
|
27 |
||
28 |
import java.io.*; |
|
29 |
import java.math.BigInteger; |
|
30 |
import java.util.*; |
|
31 |
import java.security.AccessController; |
|
32 |
import java.security.Principal; |
|
33 |
import java.security.PrivilegedAction; |
|
34 |
import java.security.Security; |
|
35 |
import java.security.cert.*; |
|
36 |
import java.net.*; |
|
37 |
import javax.security.auth.x500.X500Principal; |
|
38 |
||
39 |
import sun.security.util.*; |
|
40 |
import sun.security.x509.*; |
|
41 |
||
42 |
/** |
|
43 |
* OCSPChecker is a <code>PKIXCertPathChecker</code> that uses the |
|
44 |
* Online Certificate Status Protocol (OCSP) as specified in RFC 2560 |
|
45 |
* <a href="http://www.ietf.org/rfc/rfc2560.txt"> |
|
46 |
* http://www.ietf.org/rfc/rfc2560.txt</a>. |
|
47 |
* |
|
48 |
* @author Ram Marti |
|
49 |
*/ |
|
50 |
class OCSPChecker extends PKIXCertPathChecker { |
|
51 |
||
52 |
public static final String OCSP_ENABLE_PROP = "ocsp.enable"; |
|
53 |
public static final String OCSP_URL_PROP = "ocsp.responderURL"; |
|
54 |
public static final String OCSP_CERT_SUBJECT_PROP = |
|
55 |
"ocsp.responderCertSubjectName"; |
|
56 |
public static final String OCSP_CERT_ISSUER_PROP = |
|
57 |
"ocsp.responderCertIssuerName"; |
|
58 |
public static final String OCSP_CERT_NUMBER_PROP = |
|
59 |
"ocsp.responderCertSerialNumber"; |
|
60 |
||
61 |
private static final String HEX_DIGITS = "0123456789ABCDEFabcdef"; |
|
62 |
private static final Debug DEBUG = Debug.getInstance("certpath"); |
|
63 |
private static final boolean dump = false; |
|
64 |
||
65 |
// Supported extensions |
|
66 |
private static final int OCSP_NONCE_DATA[] = |
|
67 |
{ 1, 3, 6, 1, 5, 5, 7, 48, 1, 2 }; |
|
68 |
private static final ObjectIdentifier OCSP_NONCE_OID; |
|
69 |
static { |
|
70 |
OCSP_NONCE_OID = ObjectIdentifier.newInternal(OCSP_NONCE_DATA); |
|
71 |
} |
|
72 |
||
73 |
private int remainingCerts; |
|
74 |
||
75 |
private X509Certificate[] certs; |
|
76 |
||
77 |
private CertPath cp; |
|
78 |
||
79 |
private PKIXParameters pkixParams; |
|
80 |
||
81 |
/** |
|
82 |
* Default Constructor |
|
83 |
* |
|
84 |
* @param certPath the X509 certification path |
|
85 |
* @param pkixParams the input PKIX parameter set |
|
86 |
* @exception CertPathValidatorException Exception thrown if cert path |
|
87 |
* does not validate. |
|
88 |
*/ |
|
89 |
OCSPChecker(CertPath certPath, PKIXParameters pkixParams) |
|
90 |
throws CertPathValidatorException { |
|
91 |
||
92 |
this.cp = certPath; |
|
93 |
this.pkixParams = pkixParams; |
|
94 |
List<? extends Certificate> tmp = cp.getCertificates(); |
|
95 |
certs = tmp.toArray(new X509Certificate[tmp.size()]); |
|
96 |
init(false); |
|
97 |
} |
|
98 |
||
99 |
/** |
|
100 |
* Initializes the internal state of the checker from parameters |
|
101 |
* specified in the constructor |
|
102 |
*/ |
|
103 |
public void init(boolean forward) throws CertPathValidatorException { |
|
104 |
if (!forward) { |
|
625
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
105 |
remainingCerts = certs.length + 1; |
2 | 106 |
} else { |
107 |
throw new CertPathValidatorException( |
|
108 |
"Forward checking not supported"); |
|
109 |
} |
|
110 |
} |
|
111 |
||
112 |
public boolean isForwardCheckingSupported() { |
|
113 |
return false; |
|
114 |
} |
|
115 |
||
116 |
public Set<String> getSupportedExtensions() { |
|
117 |
return Collections.<String>emptySet(); |
|
118 |
} |
|
119 |
||
120 |
/** |
|
121 |
* Sends an OCSPRequest for the certificate to the OCSP Server and |
|
122 |
* processes the response back from the OCSP Server. |
|
123 |
* |
|
124 |
* @param cert the Certificate |
|
125 |
* @param unresolvedCritExts the unresolved critical extensions |
|
126 |
* @exception CertPathValidatorException Exception is thrown if the |
|
127 |
* certificate has been revoked. |
|
128 |
*/ |
|
129 |
public void check(Certificate cert, Collection<String> unresolvedCritExts) |
|
130 |
throws CertPathValidatorException { |
|
131 |
||
132 |
InputStream in = null; |
|
133 |
OutputStream out = null; |
|
625
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
134 |
|
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
135 |
// Decrement the certificate counter |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
136 |
remainingCerts--; |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
137 |
|
2 | 138 |
try { |
139 |
X509Certificate responderCert = null; |
|
140 |
boolean seekResponderCert = false; |
|
141 |
X500Principal responderSubjectName = null; |
|
142 |
X500Principal responderIssuerName = null; |
|
143 |
BigInteger responderSerialNumber = null; |
|
144 |
||
625
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
145 |
boolean seekIssuerCert = true; |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
146 |
X509CertImpl issuerCertImpl = null; |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
147 |
X509CertImpl currCertImpl = |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
148 |
X509CertImpl.toImpl((X509Certificate)cert); |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
149 |
|
2 | 150 |
/* |
151 |
* OCSP security property values, in the following order: |
|
152 |
* 1. ocsp.responderURL |
|
153 |
* 2. ocsp.responderCertSubjectName |
|
154 |
* 3. ocsp.responderCertIssuerName |
|
155 |
* 4. ocsp.responderCertSerialNumber |
|
156 |
*/ |
|
157 |
String[] properties = getOCSPProperties(); |
|
158 |
||
625
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
159 |
// Check whether OCSP is feasible before seeking cert information |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
160 |
URL url = getOCSPServerURL(currCertImpl, properties); |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
161 |
|
2 | 162 |
// When responder's subject name is set then the issuer/serial |
163 |
// properties are ignored |
|
164 |
if (properties[1] != null) { |
|
165 |
responderSubjectName = new X500Principal(properties[1]); |
|
166 |
||
167 |
} else if (properties[2] != null && properties[3] != null) { |
|
168 |
responderIssuerName = new X500Principal(properties[2]); |
|
169 |
// remove colon or space separators |
|
170 |
String value = stripOutSeparators(properties[3]); |
|
171 |
responderSerialNumber = new BigInteger(value, 16); |
|
172 |
||
173 |
} else if (properties[2] != null || properties[3] != null) { |
|
174 |
throw new CertPathValidatorException( |
|
175 |
"Must specify both ocsp.responderCertIssuerName and " + |
|
176 |
"ocsp.responderCertSerialNumber properties"); |
|
177 |
} |
|
178 |
||
179 |
// If the OCSP responder cert properties are set then the |
|
180 |
// identified cert must be located in the trust anchors or |
|
181 |
// in the cert stores. |
|
182 |
if (responderSubjectName != null || responderIssuerName != null) { |
|
183 |
seekResponderCert = true; |
|
184 |
} |
|
185 |
||
625
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
186 |
// Set the issuer certificate to the next cert in the chain |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
187 |
// (unless we're processing the final cert). |
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
188 |
if (remainingCerts < certs.length) { |
2 | 189 |
issuerCertImpl = X509CertImpl.toImpl(certs[remainingCerts]); |
190 |
seekIssuerCert = false; // done |
|
191 |
||
192 |
// By default, the OCSP responder's cert is the same as the |
|
193 |
// issuer of the cert being validated. |
|
194 |
if (! seekResponderCert) { |
|
195 |
responderCert = certs[remainingCerts]; |
|
196 |
if (DEBUG != null) { |
|
197 |
DEBUG.println("Responder's certificate is the same " + |
|
198 |
"as the issuer of the certificate being validated"); |
|
199 |
} |
|
200 |
} |
|
201 |
} |
|
202 |
||
203 |
// Check anchor certs for: |
|
204 |
// - the issuer cert (of the cert being validated) |
|
205 |
// - the OCSP responder's cert |
|
206 |
if (seekIssuerCert || seekResponderCert) { |
|
207 |
||
208 |
if (DEBUG != null && seekResponderCert) { |
|
209 |
DEBUG.println("Searching trust anchors for responder's " + |
|
210 |
"certificate"); |
|
211 |
} |
|
212 |
||
213 |
// Extract the anchor certs |
|
214 |
Iterator anchors = pkixParams.getTrustAnchors().iterator(); |
|
215 |
if (! anchors.hasNext()) { |
|
216 |
throw new CertPathValidatorException( |
|
217 |
"Must specify at least one trust anchor"); |
|
218 |
} |
|
219 |
||
220 |
X500Principal certIssuerName = |
|
221 |
currCertImpl.getIssuerX500Principal(); |
|
222 |
while (anchors.hasNext() && |
|
223 |
(seekIssuerCert || seekResponderCert)) { |
|
224 |
||
225 |
TrustAnchor anchor = (TrustAnchor)anchors.next(); |
|
226 |
X509Certificate anchorCert = anchor.getTrustedCert(); |
|
227 |
X500Principal anchorSubjectName = |
|
228 |
anchorCert.getSubjectX500Principal(); |
|
229 |
||
230 |
if (dump) { |
|
231 |
System.out.println("Issuer DN is " + certIssuerName); |
|
232 |
System.out.println("Subject DN is " + |
|
233 |
anchorSubjectName); |
|
234 |
} |
|
235 |
||
236 |
// Check if anchor cert is the issuer cert |
|
237 |
if (seekIssuerCert && |
|
238 |
certIssuerName.equals(anchorSubjectName)) { |
|
239 |
||
240 |
issuerCertImpl = X509CertImpl.toImpl(anchorCert); |
|
241 |
seekIssuerCert = false; // done |
|
242 |
||
243 |
// By default, the OCSP responder's cert is the same as |
|
244 |
// the issuer of the cert being validated. |
|
245 |
if (! seekResponderCert && responderCert == null) { |
|
246 |
responderCert = anchorCert; |
|
247 |
if (DEBUG != null) { |
|
248 |
DEBUG.println("Responder's certificate is the" + |
|
249 |
" same as the issuer of the certificate " + |
|
250 |
"being validated"); |
|
251 |
} |
|
252 |
} |
|
253 |
} |
|
254 |
||
255 |
// Check if anchor cert is the responder cert |
|
256 |
if (seekResponderCert) { |
|
257 |
// Satisfy the responder subject name property only, or |
|
258 |
// satisfy the responder issuer name and serial number |
|
259 |
// properties only |
|
260 |
if ((responderSubjectName != null && |
|
261 |
responderSubjectName.equals(anchorSubjectName)) || |
|
262 |
(responderIssuerName != null && |
|
263 |
responderSerialNumber != null && |
|
264 |
responderIssuerName.equals( |
|
265 |
anchorCert.getIssuerX500Principal()) && |
|
266 |
responderSerialNumber.equals( |
|
267 |
anchorCert.getSerialNumber()))) { |
|
268 |
||
269 |
responderCert = anchorCert; |
|
270 |
seekResponderCert = false; // done |
|
271 |
} |
|
272 |
} |
|
273 |
} |
|
274 |
if (issuerCertImpl == null) { |
|
275 |
throw new CertPathValidatorException( |
|
276 |
"No trusted certificate for " + |
|
277 |
currCertImpl.getIssuerDN()); |
|
278 |
} |
|
279 |
||
280 |
// Check cert stores if responder cert has not yet been found |
|
281 |
if (seekResponderCert) { |
|
282 |
if (DEBUG != null) { |
|
283 |
DEBUG.println("Searching cert stores for responder's " + |
|
284 |
"certificate"); |
|
285 |
} |
|
286 |
X509CertSelector filter = null; |
|
287 |
if (responderSubjectName != null) { |
|
288 |
filter = new X509CertSelector(); |
|
289 |
filter.setSubject(responderSubjectName.getName()); |
|
290 |
} else if (responderIssuerName != null && |
|
291 |
responderSerialNumber != null) { |
|
292 |
filter = new X509CertSelector(); |
|
293 |
filter.setIssuer(responderIssuerName.getName()); |
|
294 |
filter.setSerialNumber(responderSerialNumber); |
|
295 |
} |
|
296 |
if (filter != null) { |
|
297 |
List<CertStore> certStores = pkixParams.getCertStores(); |
|
298 |
for (CertStore certStore : certStores) { |
|
299 |
Iterator i = |
|
300 |
certStore.getCertificates(filter).iterator(); |
|
301 |
if (i.hasNext()) { |
|
302 |
responderCert = (X509Certificate) i.next(); |
|
303 |
seekResponderCert = false; // done |
|
304 |
break; |
|
305 |
} |
|
306 |
} |
|
307 |
} |
|
308 |
} |
|
309 |
} |
|
310 |
||
311 |
// Could not find the certificate identified in the OCSP properties |
|
312 |
if (seekResponderCert) { |
|
313 |
throw new CertPathValidatorException( |
|
314 |
"Cannot find the responder's certificate " + |
|
315 |
"(set using the OCSP security properties)."); |
|
316 |
} |
|
317 |
||
318 |
// Construct an OCSP Request |
|
319 |
OCSPRequest ocspRequest = |
|
320 |
new OCSPRequest(currCertImpl, issuerCertImpl); |
|
625
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
321 |
|
ba0b63c29671
6383078: OCSP checking does not work on end-entity certificate
vinnie
parents:
2
diff
changeset
|
322 |
// Use the URL to the OCSP service that was created earlier |
2 | 323 |
HttpURLConnection con = (HttpURLConnection)url.openConnection(); |
324 |
if (DEBUG != null) { |
|
325 |
DEBUG.println("connecting to OCSP service at: " + url); |
|
326 |
} |
|
327 |
||
328 |
// Indicate that both input and output will be performed, |
|
329 |
// that the method is POST, and that the content length is |
|
330 |
// the length of the byte array |
|
331 |
||
332 |
con.setDoOutput(true); |
|
333 |
con.setDoInput(true); |
|
334 |
con.setRequestMethod("POST"); |
|
335 |
con.setRequestProperty("Content-type", "application/ocsp-request"); |
|
336 |
byte[] bytes = ocspRequest.encodeBytes(); |
|
337 |
CertId certId = ocspRequest.getCertId(); |
|
338 |
||
339 |
con.setRequestProperty("Content-length", |
|
340 |
String.valueOf(bytes.length)); |
|
341 |
out = con.getOutputStream(); |
|
342 |
out.write(bytes); |
|
343 |
out.flush(); |
|
344 |
||
345 |
// Check the response |
|
346 |
if (DEBUG != null && |
|
347 |
con.getResponseCode() != HttpURLConnection.HTTP_OK) { |
|
348 |
DEBUG.println("Received HTTP error: " + con.getResponseCode() + |
|
349 |
" - " + con.getResponseMessage()); |
|
350 |
} |
|
351 |
in = con.getInputStream(); |
|
352 |
||
353 |
int contentLength = con.getContentLength(); |
|
354 |
if (contentLength == -1) { |
|
355 |
contentLength = Integer.MAX_VALUE; |
|
356 |
} |
|
357 |
||
358 |
byte[] response = new byte[contentLength]; |
|
359 |
int total = 0; |
|
360 |
int count = 0; |
|
361 |
while (count != -1 && total < contentLength) { |
|
362 |
count = in.read(response, total, response.length - total); |
|
363 |
total += count; |
|
364 |
} |
|
365 |
||
366 |
OCSPResponse ocspResponse = new OCSPResponse(response, pkixParams, |
|
367 |
responderCert); |
|
368 |
// Check that response applies to the cert that was supplied |
|
369 |
if (! certId.equals(ocspResponse.getCertId())) { |
|
370 |
throw new CertPathValidatorException( |
|
371 |
"Certificate in the OCSP response does not match the " + |
|
372 |
"certificate supplied in the OCSP request."); |
|
373 |
} |
|
374 |
SerialNumber serialNumber = currCertImpl.getSerialNumberObject(); |
|
375 |
int certOCSPStatus = ocspResponse.getCertStatus(serialNumber); |
|
376 |
||
377 |
if (DEBUG != null) { |
|
378 |
DEBUG.println("Status of certificate (with serial number " + |
|
379 |
serialNumber.getNumber() + ") is: " + |
|
380 |
OCSPResponse.certStatusToText(certOCSPStatus)); |
|
381 |
} |
|
382 |
||
383 |
if (certOCSPStatus == OCSPResponse.CERT_STATUS_REVOKED) { |
|
384 |
throw new CertPathValidatorException( |
|
385 |
new CertificateRevokedException( |
|
386 |
ocspResponse.getRevocationTime(), |
|
387 |
ocspResponse.getRevocationReason(), |
|
388 |
responderCert.getSubjectX500Principal(), |
|
389 |
ocspResponse.getSingleExtensions())); |
|
390 |
||
391 |
} else if (certOCSPStatus == OCSPResponse.CERT_STATUS_UNKNOWN) { |
|
392 |
throw new CertPathValidatorException( |
|
393 |
"Certificate's revocation status is unknown", null, cp, |
|
394 |
remainingCerts); |
|
395 |
} |
|
396 |
} catch (Exception e) { |
|
397 |
throw new CertPathValidatorException(e); |
|
398 |
} finally { |
|
399 |
if (in != null) { |
|
400 |
try { |
|
401 |
in.close(); |
|
402 |
} catch (IOException ioe) { |
|
403 |
throw new CertPathValidatorException(ioe); |
|
404 |
} |
|
405 |
} |
|
406 |
if (out != null) { |
|
407 |
try { |
|
408 |
out.close(); |
|
409 |
} catch (IOException ioe) { |
|
410 |
throw new CertPathValidatorException(ioe); |
|
411 |
} |
|
412 |
} |
|
413 |
} |
|
414 |
} |
|
415 |
||
416 |
/* |
|
417 |
* The OCSP security property values are in the following order: |
|
418 |
* 1. ocsp.responderURL |
|
419 |
* 2. ocsp.responderCertSubjectName |
|
420 |
* 3. ocsp.responderCertIssuerName |
|
421 |
* 4. ocsp.responderCertSerialNumber |
|
422 |
*/ |
|
423 |
private static URL getOCSPServerURL(X509CertImpl currCertImpl, |
|
424 |
String[] properties) |
|
425 |
throws CertificateParsingException, CertPathValidatorException { |
|
426 |
||
427 |
if (properties[0] != null) { |
|
428 |
try { |
|
429 |
return new URL(properties[0]); |
|
430 |
} catch (java.net.MalformedURLException e) { |
|
431 |
throw new CertPathValidatorException(e); |
|
432 |
} |
|
433 |
} |
|
434 |
||
435 |
// Examine the certificate's AuthorityInfoAccess extension |
|
436 |
||
437 |
AuthorityInfoAccessExtension aia = |
|
438 |
currCertImpl.getAuthorityInfoAccessExtension(); |
|
439 |
if (aia == null) { |
|
440 |
throw new CertPathValidatorException( |
|
441 |
"Must specify the location of an OCSP Responder"); |
|
442 |
} |
|
443 |
||
444 |
List<AccessDescription> descriptions = aia.getAccessDescriptions(); |
|
445 |
for (AccessDescription description : descriptions) { |
|
446 |
if (description.getAccessMethod().equals( |
|
447 |
AccessDescription.Ad_OCSP_Id)) { |
|
448 |
||
449 |
GeneralName generalName = description.getAccessLocation(); |
|
450 |
if (generalName.getType() == GeneralNameInterface.NAME_URI) { |
|
451 |
try { |
|
452 |
URIName uri = (URIName) generalName.getName(); |
|
453 |
return (new URL(uri.getName())); |
|
454 |
||
455 |
} catch (java.net.MalformedURLException e) { |
|
456 |
throw new CertPathValidatorException(e); |
|
457 |
} |
|
458 |
} |
|
459 |
} |
|
460 |
} |
|
461 |
||
462 |
throw new CertPathValidatorException( |
|
463 |
"Cannot find the location of the OCSP Responder"); |
|
464 |
} |
|
465 |
||
466 |
/* |
|
467 |
* Retrieves the values of the OCSP security properties. |
|
468 |
*/ |
|
469 |
private static String[] getOCSPProperties() { |
|
470 |
final String[] properties = new String[4]; |
|
471 |
||
472 |
AccessController.doPrivileged( |
|
473 |
new PrivilegedAction<Void>() { |
|
474 |
public Void run() { |
|
475 |
properties[0] = Security.getProperty(OCSP_URL_PROP); |
|
476 |
properties[1] = |
|
477 |
Security.getProperty(OCSP_CERT_SUBJECT_PROP); |
|
478 |
properties[2] = |
|
479 |
Security.getProperty(OCSP_CERT_ISSUER_PROP); |
|
480 |
properties[3] = |
|
481 |
Security.getProperty(OCSP_CERT_NUMBER_PROP); |
|
482 |
return null; |
|
483 |
} |
|
484 |
}); |
|
485 |
||
486 |
return properties; |
|
487 |
} |
|
488 |
||
489 |
/* |
|
490 |
* Removes any non-hexadecimal characters from a string. |
|
491 |
*/ |
|
492 |
private static String stripOutSeparators(String value) { |
|
493 |
char[] chars = value.toCharArray(); |
|
494 |
StringBuilder hexNumber = new StringBuilder(); |
|
495 |
for (int i = 0; i < chars.length; i++) { |
|
496 |
if (HEX_DIGITS.indexOf(chars[i]) != -1) { |
|
497 |
hexNumber.append(chars[i]); |
|
498 |
} |
|
499 |
} |
|
500 |
return hexNumber.toString(); |
|
501 |
} |
|
502 |
} |