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