| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_ANDROID_KEYSTORE_H | 5 #ifndef NET_ANDROID_KEYSTORE_H |
| 6 #define NET_ANDROID_KEYSTORE_H | 6 #define NET_ANDROID_KEYSTORE_H |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/android/scoped_java_ref.h" | 13 #include "base/android/scoped_java_ref.h" |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
| 16 #include "net/base/net_export.h" | 16 #include "net/base/net_export.h" |
| 17 #include "net/ssl/ssl_client_cert_type.h" | 17 #include "net/ssl/ssl_client_cert_type.h" |
| 18 | 18 |
| 19 // Misc functions to access the Android platform KeyStore. | 19 // Misc functions to access the Android platform KeyStore. |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 namespace android { | 22 namespace android { |
| 23 | 23 |
| 24 struct AndroidEVP_PKEY; | 24 struct AndroidEVP_PKEY; |
| 25 | 25 |
| 26 // Define a list of constants describing private key types. The | 26 // Define a list of constants describing private key types. The |
| 27 // values are shared with Java through org.chromium.net.PrivateKeyType. | 27 // values are shared with Java through org.chromium.net.PrivateKeyType. |
| 28 // Example: PRIVATE_KEY_TYPE_RSA. | 28 // Example: PRIVATE_KEY_TYPE_RSA. |
| 29 // |
| 30 // A Java counterpart will be generated for this enum. |
| 31 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net |
| 29 enum PrivateKeyType { | 32 enum PrivateKeyType { |
| 30 #define DEFINE_PRIVATE_KEY_TYPE(name,value) PRIVATE_KEY_TYPE_ ## name = value, | 33 PRIVATE_KEY_TYPE_RSA = 0, |
| 31 #include "net/android/private_key_type_list.h" | 34 PRIVATE_KEY_TYPE_DSA = 1, |
| 32 #undef DEFINE_PRIVATE_KEY_TYPE | 35 PRIVATE_KEY_TYPE_ECDSA = 2, |
| 36 PRIVATE_KEY_TYPE_INVALID = 255, |
| 33 }; | 37 }; |
| 34 | 38 |
| 35 // Returns the modulus of a given RSAPrivateKey platform object, | 39 // Returns the modulus of a given RSAPrivateKey platform object, |
| 36 // as a series of bytes, in big-endian representation. This can be | 40 // as a series of bytes, in big-endian representation. This can be |
| 37 // used with BN_bin2bn() to convert to an OpenSSL BIGNUM. | 41 // used with BN_bin2bn() to convert to an OpenSSL BIGNUM. |
| 38 // | 42 // |
| 39 // |private_key| is a JNI reference for the private key. | 43 // |private_key| is a JNI reference for the private key. |
| 40 // |modulus| will receive the modulus bytes on success. | 44 // |modulus| will receive the modulus bytes on success. |
| 41 // Returns true on success, or false on failure (e.g. if the key | 45 // Returns true on success, or false on failure (e.g. if the key |
| 42 // is not RSA). | 46 // is not RSA). |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 122 |
| 119 NET_EXPORT void ReleaseKey(jobject private_key); | 123 NET_EXPORT void ReleaseKey(jobject private_key); |
| 120 | 124 |
| 121 // Register JNI methods | 125 // Register JNI methods |
| 122 NET_EXPORT bool RegisterKeyStore(JNIEnv* env); | 126 NET_EXPORT bool RegisterKeyStore(JNIEnv* env); |
| 123 | 127 |
| 124 } // namespace android | 128 } // namespace android |
| 125 } // namespace net | 129 } // namespace net |
| 126 | 130 |
| 127 #endif // NET_ANDROID_KEYSTORE_H | 131 #endif // NET_ANDROID_KEYSTORE_H |
| OLD | NEW |