summaryrefslogtreecommitdiff
path: root/chromium/net/cert/known_roots_win.cc
blob: 89c9a41621b8c3b4db6dd4ff470b615ff17dafc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/cert/known_roots_win.h"

#include "base/metrics/histogram_macros.h"
#include "crypto/sha2.h"
#include "net/base/hash_value.h"
#include "net/cert/x509_util_win.h"

namespace net {

bool IsKnownRoot(PCCERT_CONTEXT cert) {
  BYTE hash_prop[32] = {0};
  DWORD size = sizeof(hash_prop);
  return CertGetCertificateContextProperty(
             cert, CERT_AUTH_ROOT_SHA256_HASH_PROP_ID, &hash_prop, &size) &&
         size == sizeof(hash_prop);
}

}  // namespace net