known_roots_mac.h 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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. #ifndef NET_CERT_KNOWN_ROOTS_MAC_H_
  5. #define NET_CERT_KNOWN_ROOTS_MAC_H_
  6. #include <Security/Security.h>
  7. #include "net/base/hash_value.h"
  8. #include "net/base/net_export.h"
  9. namespace net {
  10. // IsKnownRoot returns true if the given certificate is one that we believe
  11. // is a standard (as opposed to user-installed) root.
  12. //
  13. // NOTE: The first call will lazily initialize the known roots, which requires
  14. // holding crypto::GetMacSecurityServicesLock(). Callers must therefore either
  15. // acquire that lock prior to calling this, or eagerly initialize beforehand
  16. // using InitializeKnownRoots().
  17. NET_EXPORT_PRIVATE bool IsKnownRoot(SecCertificateRef cert);
  18. bool IsKnownRoot(const HashValue& cert_sha256);
  19. // Calling this is optional as initialization will otherwise be done lazily when
  20. // calling IsKnownRoot(). When calling this, the current thread must NOT already
  21. // be holding/ crypto::GetMacSecurityServicesLock().
  22. void InitializeKnownRoots();
  23. } // namespace net
  24. #endif // NET_CERT_KNOWN_ROOTS_MAC_H_