OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NETWORK_LIBRARY_H_ | 5 #ifndef NET_ANDROID_NETWORK_LIBRARY_H_ |
6 #define NET_ANDROID_NETWORK_LIBRARY_H_ | 6 #define NET_ANDROID_NETWORK_LIBRARY_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/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "net/base/mime_util.h" |
14 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
15 | 16 |
16 namespace net { | 17 namespace net { |
17 namespace android { | 18 namespace android { |
18 | 19 |
19 enum VerifyResult { | 20 enum VerifyResult { |
20 // Certificate verification was successful. | 21 // Certificate verification was successful. |
21 VERIFY_OK, | 22 VERIFY_OK, |
22 // Certificate verification was failed. There is no detail error information | 23 // Certificate verification was failed. There is no detail error information |
23 // given by Android API. | 24 // given by Android API. |
(...skipping 16 matching lines...) Expand all Loading... |
40 // | 41 // |
41 // Also, the private key must be in PKCS#8 format, as returned by | 42 // Also, the private key must be in PKCS#8 format, as returned by |
42 // i2d_PKCS8_PRIV_KEY_INFO(EVP_PKEY2PKCS8(pkey)), which is a different | 43 // i2d_PKCS8_PRIV_KEY_INFO(EVP_PKEY2PKCS8(pkey)), which is a different |
43 // format than what i2d_PrivateKey() returns, so don't use it either. | 44 // format than what i2d_PrivateKey() returns, so don't use it either. |
44 // | 45 // |
45 bool StoreKeyPair(const uint8* public_key, | 46 bool StoreKeyPair(const uint8* public_key, |
46 size_t public_len, | 47 size_t public_len, |
47 const uint8* private_key, | 48 const uint8* private_key, |
48 size_t private_len); | 49 size_t private_len); |
49 | 50 |
| 51 // Helper used to pass the DER-encoded bytes of an X.509 certificate or |
| 52 // a PKCS#12 archive holding a private key to the CertInstaller activity. |
| 53 void StoreCertificate(net::CertificateType cert_type, |
| 54 const void* data, |
| 55 size_t data_len); |
| 56 |
50 // Returns true if it can determine that only loopback addresses are configured. | 57 // Returns true if it can determine that only loopback addresses are configured. |
51 // i.e. if only 127.0.0.1 and ::1 are routable. | 58 // i.e. if only 127.0.0.1 and ::1 are routable. |
52 // Also returns false if it cannot determine this. | 59 // Also returns false if it cannot determine this. |
53 bool HaveOnlyLoopbackAddresses(); | 60 bool HaveOnlyLoopbackAddresses(); |
54 | 61 |
55 // Return a string containing a list of network interfaces, each item is a | 62 // Return a string containing a list of network interfaces, each item is a |
56 // network name and address pair. | 63 // network name and address pair. |
57 // e.g. "eth0,10.0.0.2;eth0,fe80::5054:ff:fe12:3456" is a result string | 64 // e.g. "eth0,10.0.0.2;eth0,fe80::5054:ff:fe12:3456" is a result string |
58 // containing two items. | 65 // containing two items. |
59 std::string GetNetworkList(); | 66 std::string GetNetworkList(); |
60 | 67 |
61 // Get the mime type (if any) that is associated with the file extension. | 68 // Get the mime type (if any) that is associated with the file extension. |
62 // Returns true if a corresponding mime type exists. | 69 // Returns true if a corresponding mime type exists. |
63 bool GetMimeTypeFromExtension(const std::string& extension, | 70 bool GetMimeTypeFromExtension(const std::string& extension, |
64 std::string* result); | 71 std::string* result); |
65 | 72 |
66 // Register JNI methods | 73 // Register JNI methods |
67 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); | 74 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); |
68 | 75 |
69 } // namespace android | 76 } // namespace android |
70 } // namespace net | 77 } // namespace net |
71 | 78 |
72 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ | 79 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ |
OLD | NEW |