known_roots_win.cc 646 B

12345678910111213141516171819202122
  1. // Copyright (c) 2017 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. #include "net/cert/known_roots_win.h"
  5. #include "base/metrics/histogram_macros.h"
  6. #include "crypto/sha2.h"
  7. #include "net/base/hash_value.h"
  8. #include "net/cert/x509_util_win.h"
  9. namespace net {
  10. bool IsKnownRoot(PCCERT_CONTEXT cert) {
  11. BYTE hash_prop[32] = {0};
  12. DWORD size = sizeof(hash_prop);
  13. return CertGetCertificateContextProperty(
  14. cert, CERT_AUTH_ROOT_SHA256_HASH_PROP_ID, &hash_prop, &size) &&
  15. size == sizeof(hash_prop);
  16. }
  17. } // namespace net