1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef RootCertificateTelemetryUtils_h
8 #define RootCertificateTelemetryUtils_h
10 #include "mozilla/Span.h"
11 #include "mozilla/Telemetry.h"
16 // Note: New CAs will show up as UNKNOWN_ROOT until
17 // RootHashes.inc is updated to include them. 0 is reserved by
18 // genRootCAHashes.js for the unknowns.
19 #define ROOT_CERTIFICATE_UNKNOWN 0
20 // 1 indicates the CA is not a built-in and comes from the softoken (cert9.db)
21 #define ROOT_CERTIFICATE_SOFTOKEN 1
22 // 2 indicates the CA is not a bilt-in and comes from an external PKCS#11 token
23 #define ROOT_CERTIFICATE_EXTERNAL_TOKEN 2
24 // 3 indicates the CA is not a built-in and comes from the OS via the
25 // "Enterprise Roots" feature
26 #define ROOT_CERTIFICATE_ENTERPRISE_ROOT 3
27 #define ROOT_CERTIFICATE_HASH_FAILURE -1
29 int32_t RootCABinNumber(Span
<const uint8_t> cert
);
31 void AccumulateTelemetryForRootCA(mozilla::Telemetry::HistogramID probe
,
32 const Span
<const uint8_t> cert
);
35 } // namespace mozilla
37 #endif // RootCertificateTelemetryUtils_h