cert_verify_proc_win.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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
  3. // found in the LICENSE file.
  4. #ifndef NET_CERT_CERT_VERIFY_PROC_WIN_H_
  5. #define NET_CERT_CERT_VERIFY_PROC_WIN_H_
  6. #include "stdint.h"
  7. #include <vector>
  8. #include "base/supports_user_data.h"
  9. #include "base/time/time.h"
  10. #include "net/cert/cert_verify_proc.h"
  11. namespace net {
  12. // Performs certificate path construction and validation using Windows'
  13. // CryptoAPI.
  14. class NET_EXPORT CertVerifyProcWin : public CertVerifyProc {
  15. public:
  16. // Diagnostic data related to Windows cert validation.
  17. class NET_EXPORT ResultDebugData : public base::SupportsUserData::Data {
  18. public:
  19. ResultDebugData(base::Time authroot_this_update,
  20. std::vector<uint8_t> authroot_sequence_number);
  21. ResultDebugData(const ResultDebugData&);
  22. ~ResultDebugData() override;
  23. static const ResultDebugData* Get(const base::SupportsUserData* debug_data);
  24. static void Create(base::Time authroot_this_update,
  25. std::vector<uint8_t> authroot_sequence_number,
  26. base::SupportsUserData* debug_data);
  27. // base::SupportsUserData::Data implementation:
  28. std::unique_ptr<Data> Clone() override;
  29. // The ThisUpdate field from the AuthRoot store in the registry. Note,
  30. // if a user has not received any AuthRoot updates, such as updates being
  31. // disabled or connectivity issues for WinHTTP, this will return a
  32. // `base::Time` that `is_null()`. Specifically, if a user is running with
  33. // the RTM version of AuthRoot (e.g. as stored in crypt32.dll), this will
  34. // not be filled.
  35. const base::Time& authroot_this_update() const {
  36. return authroot_this_update_;
  37. }
  38. // The Sequence Number from the AuthRoot store in the registry. See the
  39. // remarks in `authroot_this_update()` for situations where this may not
  40. // be filled.
  41. const std::vector<uint8_t>& authroot_sequence_number() const {
  42. return authroot_sequence_number_;
  43. }
  44. private:
  45. base::Time authroot_this_update_;
  46. std::vector<uint8_t> authroot_sequence_number_;
  47. };
  48. CertVerifyProcWin();
  49. bool SupportsAdditionalTrustAnchors() const override;
  50. protected:
  51. ~CertVerifyProcWin() override;
  52. private:
  53. int VerifyInternal(X509Certificate* cert,
  54. const std::string& hostname,
  55. const std::string& ocsp_response,
  56. const std::string& sct_list,
  57. int flags,
  58. CRLSet* crl_set,
  59. const CertificateList& additional_trust_anchors,
  60. CertVerifyResult* verify_result,
  61. const NetLogWithSource& net_log) override;
  62. };
  63. } // namespace net
  64. #endif // NET_CERT_CERT_VERIFY_PROC_WIN_H_