Skip to content

Commit 2c4d8ee

Browse files
okhttp: revert "okhttp: Add restricted AppEngine SSL setup (#2795)"
This reverts commit b753231.
1 parent 4091130 commit 2c4d8ee

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

okhttp/src/main/java/io/grpc/okhttp/OkHttpChannelBuilder.java

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,13 @@
5353
import java.net.InetSocketAddress;
5454
import java.net.SocketAddress;
5555
import java.security.GeneralSecurityException;
56-
import java.security.KeyStore;
57-
import java.security.SecureRandom;
5856
import java.util.concurrent.Executor;
5957
import java.util.concurrent.ExecutorService;
6058
import java.util.concurrent.Executors;
6159
import java.util.concurrent.TimeUnit;
6260
import javax.annotation.Nullable;
6361
import javax.net.ssl.SSLContext;
6462
import javax.net.ssl.SSLSocketFactory;
65-
import javax.net.ssl.TrustManagerFactory;
6663

6764
/** Convenience class for building channels with the OkHttp transport. */
6865
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1785")
@@ -255,25 +252,7 @@ SSLSocketFactory createSocketFactory() {
255252
case TLS:
256253
try {
257254
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());
277256
sslSocketFactory = sslContext.getSocketFactory();
278257
}
279258
return sslSocketFactory;

0 commit comments

Comments
 (0)