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 16 matching lines...) Expand all Loading... |
27 VERIFY_INVOCATION_ERROR, | 27 VERIFY_INVOCATION_ERROR, |
28 }; | 28 }; |
29 | 29 |
30 // |cert_chain| is DER encoded chain of certificates, with the server's own | 30 // |cert_chain| is DER encoded chain of certificates, with the server's own |
31 // certificate listed first. | 31 // certificate listed first. |
32 // |auth_type| is as per the Java X509Certificate.checkServerTrusted method. | 32 // |auth_type| is as per the Java X509Certificate.checkServerTrusted method. |
33 | 33 |
34 VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain, | 34 VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain, |
35 const std::string& auth_type); | 35 const std::string& auth_type); |
36 | 36 |
| 37 // Adds a certificate as a root trust certificate to the trust manager. |
| 38 // |cert| is DER encoded certificate, |len| is its length in bytes. |
| 39 void AddTestRootCertificate(const uint8* cert, size_t len); |
| 40 |
| 41 // Removes all root certificates added by |AddTestRootCertificate| calls. |
| 42 void ClearTestRootCertificates(); |
| 43 |
37 // Helper for the <keygen> handler. Passes the DER-encoded key pair via | 44 // Helper for the <keygen> handler. Passes the DER-encoded key pair via |
38 // JNI to the Credentials store. Note that the public key must be a DER | 45 // JNI to the Credentials store. Note that the public key must be a DER |
39 // encoded SubjectPublicKeyInfo (X.509), as returned by i2d_PUBKEY() | 46 // encoded SubjectPublicKeyInfo (X.509), as returned by i2d_PUBKEY() |
40 // (and *not* i2d_PublicKey(), which returns a PKCS#1 key). | 47 // (and *not* i2d_PublicKey(), which returns a PKCS#1 key). |
41 // | 48 // |
42 // Also, the private key must be in PKCS#8 format, as returned by | 49 // Also, the private key must be in PKCS#8 format, as returned by |
43 // i2d_PKCS8_PRIV_KEY_INFO(EVP_PKEY2PKCS8(pkey)), which is a different | 50 // i2d_PKCS8_PRIV_KEY_INFO(EVP_PKEY2PKCS8(pkey)), which is a different |
44 // format than what i2d_PrivateKey() returns, so don't use it either. | 51 // format than what i2d_PrivateKey() returns, so don't use it either. |
45 // | 52 // |
46 bool StoreKeyPair(const uint8* public_key, | 53 bool StoreKeyPair(const uint8* public_key, |
(...skipping 23 matching lines...) Expand all Loading... |
70 bool GetMimeTypeFromExtension(const std::string& extension, | 77 bool GetMimeTypeFromExtension(const std::string& extension, |
71 std::string* result); | 78 std::string* result); |
72 | 79 |
73 // Register JNI methods | 80 // Register JNI methods |
74 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); | 81 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); |
75 | 82 |
76 } // namespace android | 83 } // namespace android |
77 } // namespace net | 84 } // namespace net |
78 | 85 |
79 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ | 86 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ |
OLD | NEW |