|
61 | 61 | import java.io.FileReader; |
62 | 62 | import java.io.IOException; |
63 | 63 | import java.math.BigInteger; |
64 | | -import java.net.URI; |
65 | 64 | import java.security.AlgorithmParameters; |
66 | 65 | import java.security.InvalidKeyException; |
67 | 66 | import java.security.KeyFactory; |
|
86 | 85 | import java.security.spec.InvalidKeySpecException; |
87 | 86 | import java.security.spec.InvalidParameterSpecException; |
88 | 87 | import java.security.spec.PKCS8EncodedKeySpec; |
| 88 | +import java.time.ZoneId; |
| 89 | +import java.time.ZonedDateTime; |
| 90 | +import java.time.format.DateTimeFormatter; |
89 | 91 | import java.util.ArrayList; |
90 | 92 | import java.util.Base64; |
91 | 93 | import java.util.Collection; |
|
107 | 109 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; |
108 | 110 | import com.oracle.truffle.api.TruffleFile; |
109 | 111 | import com.oracle.truffle.api.nodes.Node; |
110 | | -import java.time.ZoneId; |
111 | | -import java.time.ZonedDateTime; |
112 | | -import java.time.format.DateTimeFormatter; |
113 | 112 |
|
114 | | -import sun.security.provider.certpath.OCSP; |
115 | 113 | import sun.security.util.DerValue; |
116 | 114 | import sun.security.x509.AccessDescription; |
117 | 115 | import sun.security.x509.AuthorityInfoAccessExtension; |
|
121 | 119 | import sun.security.x509.GeneralNameInterface; |
122 | 120 | import sun.security.x509.GeneralNames; |
123 | 121 | import sun.security.x509.URIName; |
| 122 | +import sun.security.x509.X509CertImpl; |
124 | 123 |
|
125 | 124 | public final class CertUtils { |
126 | 125 |
|
@@ -352,9 +351,24 @@ private static PTuple parseCAIssuers(X509Certificate cert, PythonObjectFactory f |
352 | 351 |
|
353 | 352 | @TruffleBoundary |
354 | 353 | private static PTuple parseOCSP(X509Certificate cert, PythonObjectFactory factory) { |
355 | | - URI ocsp = OCSP.getResponderURI(cert); |
356 | | - if (ocsp != null) { |
357 | | - return factory.createTuple(new String[]{ocsp.toString()}); |
| 354 | + // Inlined from sun.security.provider.certpath.OCSP#getResponderURI |
| 355 | + // Examine the certificate's AuthorityInfoAccess extension |
| 356 | + X509CertImpl certImpl = (X509CertImpl) cert; |
| 357 | + AuthorityInfoAccessExtension aia = certImpl.getAuthorityInfoAccessExtension(); |
| 358 | + if (aia == null) { |
| 359 | + return null; |
| 360 | + } |
| 361 | + |
| 362 | + List<AccessDescription> descriptions = aia.getAccessDescriptions(); |
| 363 | + for (AccessDescription description : descriptions) { |
| 364 | + if (description.getAccessMethod().equals( |
| 365 | + (Object) AccessDescription.Ad_OCSP_Id)) { |
| 366 | + GeneralName generalName = description.getAccessLocation(); |
| 367 | + if (generalName.getType() == GeneralNameInterface.NAME_URI) { |
| 368 | + URIName uri = (URIName) generalName.getName(); |
| 369 | + return factory.createTuple(new String[]{uri.getURI().toString()}); |
| 370 | + } |
| 371 | + } |
358 | 372 | } |
359 | 373 | return null; |
360 | 374 | } |
|
0 commit comments