cert_verify_result_android.h 1.8 KB

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