| 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> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 // |cert_chain| is DER encoded chain of certificates, with the server's own | 28 // |cert_chain| is DER encoded chain of certificates, with the server's own |
| 29 // certificate listed first. | 29 // certificate listed first. |
| 30 // |auth_type| is as per the Java X509Certificate.checkServerTrusted method. | 30 // |auth_type| is as per the Java X509Certificate.checkServerTrusted method. |
| 31 | 31 |
| 32 VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain, | 32 VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain, |
| 33 const std::string& auth_type); | 33 const std::string& auth_type); |
| 34 | 34 |
| 35 // Helper for the <keygen> handler. Passes the DER-encoded key pair via | 35 // Helper for the <keygen> handler. Passes the DER-encoded key pair via |
| 36 // JNI to the Credentials store. | 36 // JNI to the Credentials store. Note that the public key must be a DER |
| 37 // encoded SubjectPublicKeyInfo (X.509), as returned by i2d_PUBKEY() |
| 38 // (and *not* i2d_PublicKey(), which returns a PKCS#1 key). |
| 39 // |
| 40 // Also, the private key must be in PKCS#8 format, as returned by |
| 41 // i2d_PKCS8_PRIV_KEY_INFO(EVP_PKEY2PKCS8(pkey)), which is a different |
| 42 // format than what i2d_PrivateKey() returns, so don't use it either. |
| 43 // |
| 37 bool StoreKeyPair(const uint8* public_key, | 44 bool StoreKeyPair(const uint8* public_key, |
| 38 size_t public_len, | 45 size_t public_len, |
| 39 const uint8* private_key, | 46 const uint8* private_key, |
| 40 size_t private_len); | 47 size_t private_len); |
| 41 | 48 |
| 42 // Returns true if it can determine that only loopback addresses are configured. | 49 // Returns true if it can determine that only loopback addresses are configured. |
| 43 // i.e. if only 127.0.0.1 and ::1 are routable. | 50 // i.e. if only 127.0.0.1 and ::1 are routable. |
| 44 // Also returns false if it cannot determine this. | 51 // Also returns false if it cannot determine this. |
| 45 bool HaveOnlyLoopbackAddresses(); | 52 bool HaveOnlyLoopbackAddresses(); |
| 46 | 53 |
| 47 // Return a string containing a list of network interfaces, each item is a | 54 // Return a string containing a list of network interfaces, each item is a |
| 48 // network name and address pair. | 55 // network name and address pair. |
| 49 // e.g. "eth0,10.0.0.2;eth0,fe80::5054:ff:fe12:3456" is a result string | 56 // e.g. "eth0,10.0.0.2;eth0,fe80::5054:ff:fe12:3456" is a result string |
| 50 // containing two items. | 57 // containing two items. |
| 51 std::string GetNetworkList(); | 58 std::string GetNetworkList(); |
| 52 | 59 |
| 53 // Get the mime type (if any) that is associated with the file extension. | 60 // Get the mime type (if any) that is associated with the file extension. |
| 54 // Returns true if a corresponding mime type exists. | 61 // Returns true if a corresponding mime type exists. |
| 55 bool GetMimeTypeFromExtension(const std::string& extension, | 62 bool GetMimeTypeFromExtension(const std::string& extension, |
| 56 std::string* result); | 63 std::string* result); |
| 57 | 64 |
| 58 // Register JNI methods | 65 // Register JNI methods |
| 59 bool RegisterNetworkLibrary(JNIEnv* env); | 66 bool RegisterNetworkLibrary(JNIEnv* env); |
| 60 | 67 |
| 61 } // namespace android | 68 } // namespace android |
| 62 } // namespace net | 69 } // namespace net |
| 63 | 70 |
| 64 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ | 71 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ |
| OLD | NEW |