Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: net/android/keystore.cc

Issue 2301553002: Pass JavaRef to Java methods in net. (Closed)
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/android/keystore.h ('k') | net/android/keystore_openssl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/android/keystore.cc
diff --git a/net/android/keystore.cc b/net/android/keystore.cc
index cb179008dc724ff8e3e76b72154b49b459a325b0..d2246103e661330f4ab82afe2703b312aa83d541 100644
--- a/net/android/keystore.cc
+++ b/net/android/keystore.cc
@@ -13,15 +13,17 @@
using base::android::AttachCurrentThread;
using base::android::HasException;
+using base::android::JavaArrayOfByteArrayToStringVector;
using base::android::JavaByteArrayToByteVector;
+using base::android::JavaRef;
using base::android::ScopedJavaLocalRef;
using base::android::ToJavaByteArray;
-using base::android::JavaArrayOfByteArrayToStringVector;
namespace net {
namespace android {
-bool GetRSAKeyModulus(jobject private_key_ref, std::vector<uint8_t>* result) {
+bool GetRSAKeyModulus(const JavaRef<jobject>& private_key_ref,
+ std::vector<uint8_t>* result) {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jbyteArray> modulus_ref =
@@ -33,7 +35,8 @@ bool GetRSAKeyModulus(jobject private_key_ref, std::vector<uint8_t>* result) {
return true;
}
-bool GetECKeyOrder(jobject private_key_ref, std::vector<uint8_t>* result) {
+bool GetECKeyOrder(const JavaRef<jobject>& private_key_ref,
+ std::vector<uint8_t>* result) {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jbyteArray> order_ref =
@@ -46,7 +49,7 @@ bool GetECKeyOrder(jobject private_key_ref, std::vector<uint8_t>* result) {
return true;
}
-bool RawSignDigestWithPrivateKey(jobject private_key_ref,
+bool RawSignDigestWithPrivateKey(const JavaRef<jobject>& private_key_ref,
const base::StringPiece& digest,
std::vector<uint8_t>* signature) {
JNIEnv* env = AttachCurrentThread();
@@ -68,13 +71,14 @@ bool RawSignDigestWithPrivateKey(jobject private_key_ref,
return true;
}
-PrivateKeyType GetPrivateKeyType(jobject private_key_ref) {
+PrivateKeyType GetPrivateKeyType(const JavaRef<jobject>& private_key_ref) {
JNIEnv* env = AttachCurrentThread();
int type = Java_AndroidKeyStore_getPrivateKeyType(env, private_key_ref);
return static_cast<PrivateKeyType>(type);
}
-AndroidEVP_PKEY* GetOpenSSLSystemHandleForPrivateKey(jobject private_key_ref) {
+AndroidEVP_PKEY* GetOpenSSLSystemHandleForPrivateKey(
+ const JavaRef<jobject>& private_key_ref) {
JNIEnv* env = AttachCurrentThread();
// Note: the pointer is passed as a jint here because that's how it
// is stored in the Java object. Java doesn't have a primitive type
@@ -90,7 +94,7 @@ AndroidEVP_PKEY* GetOpenSSLSystemHandleForPrivateKey(jobject private_key_ref) {
}
ScopedJavaLocalRef<jobject> GetOpenSSLEngineForPrivateKey(
- jobject private_key_ref) {
+ const JavaRef<jobject>& private_key_ref) {
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> engine =
Java_AndroidKeyStore_getOpenSSLEngineForPrivateKey(env, private_key_ref);
« no previous file with comments | « net/android/keystore.h ('k') | net/android/keystore_openssl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698