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 VERIFY_INVOCATION_ERROR, | 26 VERIFY_INVOCATION_ERROR, |
27 }; | 27 }; |
28 | 28 |
29 // |cert_chain| is DER encoded chain of certificates, with the server's own | 29 // |cert_chain| is DER encoded chain of certificates, with the server's own |
30 // certificate listed first. | 30 // certificate listed first. |
31 // |auth_type| is as per the Java X509Certificate.checkServerTrusted method. | 31 // |auth_type| is as per the Java X509Certificate.checkServerTrusted method. |
32 | 32 |
33 VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain, | 33 VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain, |
34 const std::string& auth_type); | 34 const std::string& auth_type); |
35 | 35 |
| 36 // Adds a certificate as a root trust certificate to the trust manager. |
| 37 // |cert| is DER encoded certificate, |len| is its length in bytes. |
| 38 void AddTestRootCertificate(const uint8* cert, size_t len); |
| 39 |
| 40 // Removes all root certificates added by |AddTestRootCertificate| calls. |
| 41 void ClearTestRootCertificates(); |
| 42 |
36 // Helper for the <keygen> handler. Passes the DER-encoded key pair via | 43 // Helper for the <keygen> handler. Passes the DER-encoded key pair via |
37 // JNI to the Credentials store. Note that the public key must be a DER | 44 // JNI to the Credentials store. Note that the public key must be a DER |
38 // encoded SubjectPublicKeyInfo (X.509), as returned by i2d_PUBKEY() | 45 // encoded SubjectPublicKeyInfo (X.509), as returned by i2d_PUBKEY() |
39 // (and *not* i2d_PublicKey(), which returns a PKCS#1 key). | 46 // (and *not* i2d_PublicKey(), which returns a PKCS#1 key). |
40 // | 47 // |
41 // Also, the private key must be in PKCS#8 format, as returned by | 48 // 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 | 49 // 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. | 50 // format than what i2d_PrivateKey() returns, so don't use it either. |
44 // | 51 // |
45 bool StoreKeyPair(const uint8* public_key, | 52 bool StoreKeyPair(const uint8* public_key, |
(...skipping 17 matching lines...) Expand all Loading... |
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 |