|
46 | 46 | import java.nio.ByteBuffer; |
47 | 47 | import java.nio.charset.StandardCharsets; |
48 | 48 | import java.nio.file.Path; |
49 | | -import java.security.AccessController; |
50 | 49 | import java.security.KeyManagementException; |
51 | 50 | import java.security.KeyStore; |
52 | 51 | import java.security.KeyStoreException; |
53 | 52 | import java.security.NoSuchAlgorithmException; |
54 | 53 | import java.security.NoSuchProviderException; |
55 | | -import java.security.PrivilegedActionException; |
56 | | -import java.security.PrivilegedExceptionAction; |
57 | 54 | import java.security.SecureRandom; |
58 | 55 | import java.security.UnrecoverableKeyException; |
59 | 56 | import java.security.cert.CertificateException; |
@@ -1165,20 +1162,14 @@ public static Engine current() { |
1165 | 1162 |
|
1166 | 1163 | @SuppressFBWarnings(value = "PATH_TRAVERSAL_IN", justification = "File path is loaded from system properties.") |
1167 | 1164 | static KeyStore getCacertsKeyStore() |
1168 | | - throws PrivilegedActionException, KeyStoreException, NoSuchProviderException, CertificateException, |
1169 | | - NoSuchAlgorithmException, IOException { |
1170 | | - Map<String, String> properties = |
1171 | | - AccessController.doPrivileged((PrivilegedExceptionAction<Map<String, String>>) () -> { |
1172 | | - Map<String, String> result = new HashMap<>(); |
1173 | | - result.put("trustStore", System.getProperty("javax.net.ssl.trustStore")); |
1174 | | - result.put("javaHome", System.getProperty("java.home")); |
1175 | | - result.put( |
1176 | | - "trustStoreType", |
1177 | | - System.getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType())); |
1178 | | - result.put("trustStoreProvider", System.getProperty("javax.net.ssl.trustStoreProvider", "")); |
1179 | | - result.put("trustStorePasswd", System.getProperty("javax.net.ssl.trustStorePassword", "")); |
1180 | | - return result; |
1181 | | - }); |
| 1165 | + throws KeyStoreException, NoSuchProviderException, CertificateException, NoSuchAlgorithmException, |
| 1166 | + IOException { |
| 1167 | + Map<String, String> properties = new HashMap<>(); |
| 1168 | + properties.put("trustStore", System.getProperty("javax.net.ssl.trustStore")); |
| 1169 | + properties.put("javaHome", System.getProperty("java.home")); |
| 1170 | + properties.put("trustStoreType", System.getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType())); |
| 1171 | + properties.put("trustStoreProvider", System.getProperty("javax.net.ssl.trustStoreProvider", "")); |
| 1172 | + properties.put("trustStorePasswd", System.getProperty("javax.net.ssl.trustStorePassword", "")); |
1182 | 1173 | KeyStore keystore = null; |
1183 | 1174 |
|
1184 | 1175 | FileInputStream trustStoreStream = null; |
@@ -1243,20 +1234,18 @@ static KeyStore getCacertsKeyStore() |
1243 | 1234 | } |
1244 | 1235 |
|
1245 | 1236 | @CheckForNull |
1246 | | - private static FileInputStream getFileInputStream(final File file) throws PrivilegedActionException { |
1247 | | - return AccessController.doPrivileged((PrivilegedExceptionAction<FileInputStream>) () -> { |
1248 | | - try { |
1249 | | - return file.exists() ? new FileInputStream(file) : null; |
1250 | | - } catch (FileNotFoundException e) { |
1251 | | - return null; |
1252 | | - } |
1253 | | - }); |
| 1237 | + private static FileInputStream getFileInputStream(final File file) { |
| 1238 | + try { |
| 1239 | + return file.exists() ? new FileInputStream(file) : null; |
| 1240 | + } catch (FileNotFoundException e) { |
| 1241 | + return null; |
| 1242 | + } |
1254 | 1243 | } |
1255 | 1244 |
|
1256 | 1245 | @CheckForNull |
1257 | 1246 | private static SSLContext getSSLContext(List<X509Certificate> x509Certificates, boolean noCertificateCheck) |
1258 | | - throws PrivilegedActionException, KeyStoreException, NoSuchProviderException, CertificateException, |
1259 | | - NoSuchAlgorithmException, IOException, KeyManagementException { |
| 1247 | + throws KeyStoreException, NoSuchProviderException, CertificateException, NoSuchAlgorithmException, |
| 1248 | + IOException, KeyManagementException { |
1260 | 1249 | SSLContext sslContext = null; |
1261 | 1250 | if (noCertificateCheck) { |
1262 | 1251 | sslContext = SSLContext.getInstance("TLS"); |
@@ -1285,8 +1274,8 @@ private static SSLContext getSSLContext(List<X509Certificate> x509Certificates, |
1285 | 1274 | @CheckForNull |
1286 | 1275 | @Restricted(NoExternalUse.class) |
1287 | 1276 | static SSLSocketFactory getSSLSocketFactory(List<X509Certificate> x509Certificates, boolean noCertificateCheck) |
1288 | | - throws PrivilegedActionException, KeyStoreException, NoSuchProviderException, CertificateException, |
1289 | | - NoSuchAlgorithmException, IOException, KeyManagementException { |
| 1277 | + throws KeyStoreException, NoSuchProviderException, CertificateException, NoSuchAlgorithmException, |
| 1278 | + IOException, KeyManagementException { |
1290 | 1279 | SSLContext sslContext = getSSLContext(x509Certificates, noCertificateCheck); |
1291 | 1280 | return sslContext != null ? sslContext.getSocketFactory() : null; |
1292 | 1281 | } |
|
0 commit comments