|
53 | 53 | import java.net.InetSocketAddress; |
54 | 54 | import java.net.SocketAddress; |
55 | 55 | import java.security.GeneralSecurityException; |
56 | | -import java.security.KeyStore; |
57 | | -import java.security.SecureRandom; |
58 | 56 | import java.util.concurrent.Executor; |
59 | 57 | import java.util.concurrent.ExecutorService; |
60 | 58 | import java.util.concurrent.Executors; |
61 | 59 | import java.util.concurrent.TimeUnit; |
62 | 60 | import javax.annotation.Nullable; |
63 | 61 | import javax.net.ssl.SSLContext; |
64 | 62 | import javax.net.ssl.SSLSocketFactory; |
65 | | -import javax.net.ssl.TrustManagerFactory; |
66 | 63 |
|
67 | 64 | /** Convenience class for building channels with the OkHttp transport. */ |
68 | 65 | @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1785") |
@@ -255,25 +252,7 @@ SSLSocketFactory createSocketFactory() { |
255 | 252 | case TLS: |
256 | 253 | try { |
257 | 254 | if (sslSocketFactory == null) { |
258 | | - SSLContext sslContext; |
259 | | - if (GrpcUtil.IS_RESTRICTED_APPENGINE) { |
260 | | - // The following auth code circumvents the following AccessControlException: |
261 | | - // access denied ("java.util.PropertyPermission" "javax.net.ssl.keyStore" "read") |
262 | | - // Conscrypt will attempt to load the default KeyStore if a trust manager is not |
263 | | - // provided, which is forbidden on AppEngine |
264 | | - sslContext = SSLContext.getInstance("TLS", Platform.get().getProvider()); |
265 | | - TrustManagerFactory trustManagerFactory = |
266 | | - TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); |
267 | | - trustManagerFactory.init((KeyStore) null); |
268 | | - sslContext.init( |
269 | | - null, |
270 | | - trustManagerFactory.getTrustManagers(), |
271 | | - // Use an algorithm that doesn't need /dev/urandom |
272 | | - SecureRandom.getInstance("SHA1PRNG", Platform.get().getProvider())); |
273 | | - |
274 | | - } else { |
275 | | - sslContext = SSLContext.getInstance("Default", Platform.get().getProvider()); |
276 | | - } |
| 255 | + SSLContext sslContext = SSLContext.getInstance("Default", Platform.get().getProvider()); |
277 | 256 | sslSocketFactory = sslContext.getSocketFactory(); |
278 | 257 | } |
279 | 258 | return sslSocketFactory; |
|
0 commit comments