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 AddLocalRootCertificate(const uint8* cert, size_t len); | |
digit1
2012/11/28 10:42:34
I think it'd prefer if we called this AddTestRootC
ppi
2012/11/28 13:37:31
Sure - done in patch set 2 (both in Java as well a
| |
39 | |
40 // Removes all root certificates added by |AddLocalRootCertificate| calls. | |
41 void ClearLocalRootCertificates(); | |
42 | |
43 | |
36 // 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 |
37 // 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 |
38 // encoded SubjectPublicKeyInfo (X.509), as returned by i2d_PUBKEY() | 46 // encoded SubjectPublicKeyInfo (X.509), as returned by i2d_PUBKEY() |
39 // (and *not* i2d_PublicKey(), which returns a PKCS#1 key). | 47 // (and *not* i2d_PublicKey(), which returns a PKCS#1 key). |
40 // | 48 // |
41 // 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 |
42 // 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 |
43 // 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. |
44 // | 52 // |
45 bool StoreKeyPair(const uint8* public_key, | 53 bool StoreKeyPair(const uint8* public_key, |
(...skipping 17 matching lines...) Expand all Loading... | |
63 bool GetMimeTypeFromExtension(const std::string& extension, | 71 bool GetMimeTypeFromExtension(const std::string& extension, |
64 std::string* result); | 72 std::string* result); |
65 | 73 |
66 // Register JNI methods | 74 // Register JNI methods |
67 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); | 75 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); |
68 | 76 |
69 } // namespace android | 77 } // namespace android |
70 } // namespace net | 78 } // namespace net |
71 | 79 |
72 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ | 80 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ |
OLD | NEW |