OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_CERT_VERIFY_RESULT_ANDROID_H_ | 5 #ifndef NET_ANDROID_CERT_VERIFY_RESULT_ANDROID_H_ |
6 #define NET_ANDROID_CERT_VERIFY_RESULT_ANDROID_H_ | 6 #define NET_ANDROID_CERT_VERIFY_RESULT_ANDROID_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 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 namespace android { | 17 namespace android { |
18 | 18 |
| 19 // The list of certificate verification results returned from Java side to the |
| 20 // C++ side. |
| 21 // |
| 22 // A Java counterpart will be generated for this enum. |
| 23 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net |
19 enum CertVerifyStatusAndroid { | 24 enum CertVerifyStatusAndroid { |
20 #define CERT_VERIFY_STATUS_ANDROID(label, value) VERIFY_ ## label = value, | 25 // Certificate is trusted. |
21 #include "net/android/cert_verify_status_android_list.h" | 26 CERT_VERIFY_STATUS_ANDROID_OK = 0, |
22 #undef CERT_VERIFY_STATUS_ANDROID | 27 // Certificate verification could not be conducted. |
| 28 CERT_VERIFY_STATUS_ANDROID_FAILED = -1, |
| 29 // Certificate is not trusted due to non-trusted root of the certificate |
| 30 // chain. |
| 31 CERT_VERIFY_STATUS_ANDROID_NO_TRUSTED_ROOT = -2, |
| 32 // Certificate is not trusted because it has expired. |
| 33 CERT_VERIFY_STATUS_ANDROID_EXPIRED = -3, |
| 34 // Certificate is not trusted because it is not valid yet. |
| 35 CERT_VERIFY_STATUS_ANDROID_NOT_YET_VALID = -4, |
| 36 // Certificate is not trusted because it could not be parsed. |
| 37 CERT_VERIFY_STATUS_ANDROID_UNABLE_TO_PARSE = -5, |
| 38 // Certificate is not trusted because it has an extendedKeyUsage field, but |
| 39 // its value is not correct for a web server. |
| 40 CERT_VERIFY_STATUS_ANDROID_INCORRECT_KEY_USAGE = -6, |
23 }; | 41 }; |
24 | 42 |
25 // Extract parameters out of an AndroidCertVerifyResult object. | 43 // Extract parameters out of an AndroidCertVerifyResult object. |
26 void ExtractCertVerifyResult(jobject result, | 44 void ExtractCertVerifyResult(jobject result, |
27 CertVerifyStatusAndroid* status, | 45 CertVerifyStatusAndroid* status, |
28 bool* is_issued_by_known_root, | 46 bool* is_issued_by_known_root, |
29 std::vector<std::string>* verified_chain); | 47 std::vector<std::string>* verified_chain); |
30 | 48 |
31 // Register JNI methods. | 49 // Register JNI methods. |
32 bool RegisterCertVerifyResult(JNIEnv* env); | 50 bool RegisterCertVerifyResult(JNIEnv* env); |
33 | 51 |
34 } // namespace android | 52 } // namespace android |
35 | 53 |
36 } // namespace net | 54 } // namespace net |
37 | 55 |
38 #endif // NET_ANDROID_CERT_VERIFY_RESULT_ANDROID_H_ | 56 #endif // NET_ANDROID_CERT_VERIFY_RESULT_ANDROID_H_ |
OLD | NEW |