NativeCrypto: not finding a key is not fatal
If we don't find a key in the keystore, we should just return null
reference. The only time we should throw exceptions is when the key
decoding failed or something else like that.
Bug: 20488918
Change-Id: I85408615a9c7a63242178908f309f93a2972033c
diff --git a/src/main/native/org_conscrypt_NativeCrypto.cpp b/src/main/native/org_conscrypt_NativeCrypto.cpp
index 4dc22dc..9590cd6 100644
--- a/src/main/native/org_conscrypt_NativeCrypto.cpp
+++ b/src/main/native/org_conscrypt_NativeCrypto.cpp
@@ -2343,7 +2343,7 @@
#else
Unique_EVP_PKEY pkey(EVP_PKEY_from_keystore(id.c_str()));
if (pkey.get() == NULL) {
- jniThrowRuntimeException(env, "Failed to find named key in keystore");
+ throwExceptionIfNecessary(env, "ENGINE_load_private_key");
return 0;
}
return reinterpret_cast<uintptr_t>(pkey.release());