Merge pull request #21395 from kaya/master

Allow default use of system root certs on Android.
pull/21418/head
Eric Gribkoff 5 years ago committed by GitHub
commit 3ebb5e1490
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      src/android/test/interop/app/src/androidTest/java/io/grpc/interop/cpp/InteropTest.java
  2. 4475
      src/android/test/interop/app/src/main/assets/roots.pem
  3. 9
      src/android/test/interop/app/src/main/cpp/grpc-interop.cc
  4. 2
      src/android/test/interop/app/src/main/java/io/grpc/interop/cpp/InteropActivity.java
  5. 4
      src/core/lib/security/security_connector/load_system_roots_fallback.cc
  6. 4
      src/core/lib/security/security_connector/load_system_roots_linux.cc

@ -43,22 +43,6 @@ public class InteropTest {
port = Integer.parseInt(InstrumentationRegistry.getArguments().getString("server_port", "443"));
useTls =
Boolean.parseBoolean(InstrumentationRegistry.getArguments().getString("use_tls", "true"));
if (useTls) {
Context ctx = InstrumentationRegistry.getTargetContext();
String sslRootsFile = "roots.pem";
InputStream in = ctx.getAssets().open(sslRootsFile);
File outFile = new File(ctx.getExternalFilesDir(null), sslRootsFile);
OutputStream out = new FileOutputStream(outFile);
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(buffer)) != -1) {
out.write(buffer, 0, bytesRead);
}
in.close();
out.close();
InteropActivity.configureSslRoots(outFile.getCanonicalPath());
}
}
@Test

File diff suppressed because it is too large Load Diff

@ -22,15 +22,6 @@
#include "src/core/lib/security/security_connector/ssl_utils_config.h"
#include "test/cpp/interop/interop_client.h"
extern "C" JNIEXPORT void JNICALL
Java_io_grpc_interop_cpp_InteropActivity_configureSslRoots(JNIEnv* env,
jobject obj_this,
jstring path_raw) {
const char* path = env->GetStringUTFChars(path_raw, (jboolean*)0);
GPR_GLOBAL_CONFIG_SET(grpc_default_ssl_roots_file_path, path);
}
std::shared_ptr<grpc::testing::InteropClient> GetClient(const char* host,
int port,
bool use_tls) {

@ -106,8 +106,6 @@ public class InteropActivity extends AppCompatActivity {
}
}
public static native void configureSslRoots(String path);
public static native boolean doEmpty(String host, int port, boolean useTls);
public static native boolean doLargeUnary(String host, int port, boolean useTls);

@ -21,7 +21,7 @@
#include <grpc/slice_buffer.h>
#include "src/core/lib/security/security_connector/load_system_roots.h"
#ifndef GPR_LINUX
#if !defined(GPR_LINUX) && !defined(GPR_ANDROID)
namespace grpc_core {
@ -29,4 +29,4 @@ grpc_slice LoadSystemRootCerts() { return grpc_empty_slice(); }
} // namespace grpc_core
#endif /* GPR_LINUX */
#endif /* !(GPR_LINUX || GPR_ANDROID) */

@ -21,7 +21,7 @@
#include <grpc/slice_buffer.h>
#include "src/core/lib/security/security_connector/load_system_roots_linux.h"
#ifdef GPR_LINUX
#if defined(GPR_LINUX) || defined(GPR_ANDROID)
#include "src/core/lib/security/security_connector/load_system_roots.h"
@ -167,4 +167,4 @@ grpc_slice LoadSystemRootCerts() {
} // namespace grpc_core
#endif /* GPR_LINUX */
#endif /* GPR_LINUX || GPR_ANDROID */

Loading…
Cancel
Save