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

Unified Diff: net/android/keystore.h

Issue 11571059: Add net/android/keystore.h (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add DSA + ECDSA test keys and signing tests Created 7 years, 11 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
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

Powered by Google App Engine
This is Rietveld 408576698