Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: net/android/network_library.h

Issue 12212135: Return specific cert verification errors on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/android/java/src/org/chromium/net/X509Util.java ('k') | net/android/network_library.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "net/android/cert_verify_result_android.h"
14 #include "net/base/mime_util.h" 15 #include "net/base/mime_util.h"
15 #include "net/base/net_export.h" 16 #include "net/base/net_export.h"
16 17
17 namespace net { 18 namespace net {
18 namespace android { 19 namespace android {
19 20
20 enum VerifyResult {
21 // Certificate verification was successful.
22 VERIFY_OK,
23 // Certificate verification was failed. There is no detail error information
24 // given by Android API.
25 VERIFY_NO_TRUSTED_ROOT,
26 // Error occurs when invoke JNI methods.
27 VERIFY_INVOCATION_ERROR,
28 };
29
30 // |cert_chain| is DER encoded chain of certificates, with the server's own 21 // |cert_chain| is DER encoded chain of certificates, with the server's own
31 // certificate listed first. 22 // certificate listed first.
32 // |auth_type| is as per the Java X509Certificate.checkServerTrusted method. 23 // |auth_type| is as per the Java X509Certificate.checkServerTrusted method.
33 24 CertVerifyResultAndroid VerifyX509CertChain(
34 VerifyResult VerifyX509CertChain(const std::vector<std::string>& cert_chain, 25 const std::vector<std::string>& cert_chain,
35 const std::string& auth_type); 26 const std::string& auth_type);
36 27
37 // Adds a certificate as a root trust certificate to the trust manager. 28 // Adds a certificate as a root trust certificate to the trust manager.
38 // |cert| is DER encoded certificate, |len| is its length in bytes. 29 // |cert| is DER encoded certificate, |len| is its length in bytes.
39 void AddTestRootCertificate(const uint8* cert, size_t len); 30 void AddTestRootCertificate(const uint8* cert, size_t len);
40 31
41 // Removes all root certificates added by |AddTestRootCertificate| calls. 32 // Removes all root certificates added by |AddTestRootCertificate| calls.
42 void ClearTestRootCertificates(); 33 void ClearTestRootCertificates();
43 34
44 // 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
45 // JNI to the Credentials store. Note that the public key must be a DER 36 // JNI to the Credentials store. Note that the public key must be a DER
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 bool GetMimeTypeFromExtension(const std::string& extension, 68 bool GetMimeTypeFromExtension(const std::string& extension,
78 std::string* result); 69 std::string* result);
79 70
80 // Register JNI methods 71 // Register JNI methods
81 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env); 72 NET_EXPORT bool RegisterNetworkLibrary(JNIEnv* env);
82 73
83 } // namespace android 74 } // namespace android
84 } // namespace net 75 } // namespace net
85 76
86 #endif // NET_ANDROID_NETWORK_LIBRARY_H_ 77 #endif // NET_ANDROID_NETWORK_LIBRARY_H_
OLDNEW
« no previous file with comments | « net/android/java/src/org/chromium/net/X509Util.java ('k') | net/android/network_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698