Index: net/android/keystore.h |
diff --git a/net/android/keystore.h b/net/android/keystore.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5173828016205b3a7bf3fb2ea56fe7238fe0f119 |
--- /dev/null |
+++ b/net/android/keystore.h |
@@ -0,0 +1,52 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NET_ANDROID_KEYSTORE_H |
+#define NET_ANDROID_KEYSTORE_H |
+ |
+#include <jni.h> |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/basictypes.h" |
+#include "base/string_piece.h" |
+#include "net/base/net_export.h" |
+#include "net/base/ssl_client_cert_type.h" |
+ |
+// Misc classes to access the Android platform KeyStore. |
+ |
+namespace net { |
+namespace android { |
+ |
+// Compute the signature of a given message, using a private key. |
+// This is used to implement OpenSSL's client certificate signing |
+// callback, so must end up implementing the same thing than |
+// RSA_sign() / DSA_sign() / ECDSA_sign(), depending on the key |
+// type. |
+// |
+// |private_key| is a JNI reference for the private key. |
+// |message| is the input message. |
+// |signature| will receive the signature on success. |
+// Returns true on success, false on failure. |
+// |
+bool SignWithPrivateKey( |
+ jobject private_key, |
+ const base::StringPiece& message, |
+ std::vector<uint8>* signature); |
+ |
+ |
+// Return the SSLClientCertType of a given private key. |
+// |private_key| is a JNI reference for the private key. |
+// Returns a SSLClientCertType, while will be CLIENT_CERT_INVALID_TYPE |
+// on error. |
+SSLClientCertType GetPrivateKeySigningType(jobject private_key); |
Ryan Sleevi
2013/01/26 01:51:57
This is the wrong enum to use.
The determination
digit1
2013/01/28 10:16:30
Ok, I'll not touch SSLClientCertType then, and try
|
+ |
+// Register JNI methods |
+NET_EXPORT bool RegisterKeyStore(JNIEnv* env); |
+ |
+} // namespace android |
+} // namespace net |
+ |
+#endif // NET_ANDROID_KEYSTORE_H |