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

Unified Diff: net/android/keystore.h

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/cert_verify_result_android.cc ('k') | net/android/keystore.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/android/keystore.h
diff --git a/net/android/keystore.h b/net/android/keystore.h
index aec51079772e066d90e35bdcb7345443345a47f4..7691c2629325e82c8c9ac68432d15efe92fbc5a7 100644
--- a/net/android/keystore.h
+++ b/net/android/keystore.h
@@ -47,8 +47,9 @@ enum PrivateKeyType {
// |modulus| will receive the modulus bytes on success.
// Returns true on success, or false on failure (e.g. if the key
// is not RSA).
-NET_EXPORT bool GetRSAKeyModulus(jobject private_key,
- std::vector<uint8_t>* modulus);
+NET_EXPORT bool GetRSAKeyModulus(
+ const base::android::JavaRef<jobject>& private_key,
+ std::vector<uint8_t>* modulus);
// Returns the order parameter of a given ECPrivateKey platform object,
// as a series of bytes, in big-endian representation. This can be used
@@ -57,7 +58,8 @@ NET_EXPORT bool GetRSAKeyModulus(jobject private_key,
// |order| will receive the result bytes on success.
// Returns true on success, or false on failure (e.g. if the key is
// not EC).
-bool GetECKeyOrder(jobject private_key, std::vector<uint8_t>* order);
+bool GetECKeyOrder(const base::android::JavaRef<jobject>& private_key,
+ std::vector<uint8_t>* order);
// Compute the signature of a given message, which is actually a hash,
// using a private key. For more details, please read the comments for the
@@ -68,15 +70,17 @@ bool GetECKeyOrder(jobject private_key, std::vector<uint8_t>* order);
// |signature| will receive the signature on success.
// Returns true on success, false on failure.
//
-NET_EXPORT bool RawSignDigestWithPrivateKey(jobject private_key,
- const base::StringPiece& digest,
- std::vector<uint8_t>* signature);
+NET_EXPORT bool RawSignDigestWithPrivateKey(
+ const base::android::JavaRef<jobject>& private_key,
+ const base::StringPiece& digest,
+ std::vector<uint8_t>* signature);
// Return the PrivateKeyType of a given private key.
// |private_key| is a JNI reference for the private key.
// Returns a PrivateKeyType, while will be CLIENT_CERT_INVALID_TYPE
// on error.
-NET_EXPORT PrivateKeyType GetPrivateKeyType(jobject private_key);
+NET_EXPORT PrivateKeyType
+GetPrivateKeyType(const base::android::JavaRef<jobject>& private_key);
// Returns a handle to the system AndroidEVP_PKEY object used to back a given
// private_key object. This must *only* be used for RSA private keys on Android
@@ -91,7 +95,8 @@ NET_EXPORT PrivateKeyType GetPrivateKeyType(jobject private_key);
// anything about OpenSSL, it just type-casts a system pointer that
// is passed as an int through JNI. As such, it never increments
// the returned key's reference count.
-AndroidEVP_PKEY* GetOpenSSLSystemHandleForPrivateKey(jobject private_key);
+AndroidEVP_PKEY* GetOpenSSLSystemHandleForPrivateKey(
+ const base::android::JavaRef<jobject>& private_key);
// Returns a JNI reference to the OpenSSLEngine object which is used to back a
// given private_key object. This must *only* be used for RSA private keys on
@@ -99,7 +104,7 @@ AndroidEVP_PKEY* GetOpenSSLSystemHandleForPrivateKey(jobject private_key);
// image contains a vanilla implementation of the Java API frameworks based on
// Harmony + OpenSSL.
base::android::ScopedJavaLocalRef<jobject> GetOpenSSLEngineForPrivateKey(
- jobject private_key);
+ const base::android::JavaRef<jobject>& private_key);
} // namespace android
} // namespace net
« no previous file with comments | « net/android/cert_verify_result_android.cc ('k') | net/android/keystore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698