| 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 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 bool* is_issued_by_known_root, | 29 bool* is_issued_by_known_root, |
| 30 std::vector<std::string>* verified_chain); | 30 std::vector<std::string>* verified_chain); |
| 31 | 31 |
| 32 // Adds a certificate as a root trust certificate to the trust manager. | 32 // Adds a certificate as a root trust certificate to the trust manager. |
| 33 // |cert| is DER encoded certificate, |len| is its length in bytes. | 33 // |cert| is DER encoded certificate, |len| is its length in bytes. |
| 34 void AddTestRootCertificate(const uint8_t* cert, size_t len); | 34 void AddTestRootCertificate(const uint8_t* cert, size_t len); |
| 35 | 35 |
| 36 // Removes all root certificates added by |AddTestRootCertificate| calls. | 36 // Removes all root certificates added by |AddTestRootCertificate| calls. |
| 37 void ClearTestRootCertificates(); | 37 void ClearTestRootCertificates(); |
| 38 | 38 |
| 39 // Helper for the <keygen> handler. Passes the DER-encoded key pair via | 39 // Helper for the <keygen> handler. Passes the DER-encoded key pair via JNI to |
| 40 // JNI to the Credentials store. Note that the public key must be a DER | 40 // the Credentials store. The public key should be a DER-encoded |
| 41 // encoded SubjectPublicKeyInfo (X.509), as returned by i2d_PUBKEY() | 41 // SubjectPublicKeyInfo (X.509) and the private key a DER-encode PrivateKeyInfo |
| 42 // (and *not* i2d_PublicKey(), which returns a PKCS#1 key). | 42 // (PKCS#8). |
| 43 // | |
| 44 // Also, the private key must be in PKCS#8 format, as returned by | |
| 45 // i2d_PKCS8_PRIV_KEY_INFO(EVP_PKEY2PKCS8(pkey)), which is a different | |
| 46 // format than what i2d_PrivateKey() returns, so don't use it either. | |
| 47 // | |
| 48 bool StoreKeyPair(const uint8_t* public_key, | 43 bool StoreKeyPair(const uint8_t* public_key, |
| 49 size_t public_len, | 44 size_t public_len, |
| 50 const uint8_t* private_key, | 45 const uint8_t* private_key, |
| 51 size_t private_len); | 46 size_t private_len); |
| 52 | 47 |
| 53 // Helper used to pass the DER-encoded bytes of an X.509 certificate or | 48 // Helper used to pass the DER-encoded bytes of an X.509 certificate or |
| 54 // a PKCS#12 archive holding a private key to the CertInstaller activity. | 49 // a PKCS#12 archive holding a private key to the CertInstaller activity. |
| 55 NET_EXPORT void StoreCertificate(CertificateMimeType cert_type, | 50 NET_EXPORT void StoreCertificate(CertificateMimeType cert_type, |
| 56 const void* data, | 51 const void* data, |
| 57 size_t data_len); | 52 size_t data_len); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 82 // true, it suggests that use of data may incur extra costs. | 77 // true, it suggests that use of data may incur extra costs. |
| 83 NET_EXPORT bool GetIsRoaming(); | 78 NET_EXPORT bool GetIsRoaming(); |
| 84 | 79 |
| 85 // Register JNI methods | 80 // Register JNI methods |
| 86 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); | 81 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); |
| 87 | 82 |
| 88 } // namespace android | 83 } // namespace android |
| 89 } // namespace net | 84 } // namespace net |
| 90 | 85 |
| 91 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ | 86 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ |
| OLD | NEW |