1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
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 EnterpriseRoots_h
8 #define EnterpriseRoots_h
10 #include "ScopedNSSTypes.h"
11 #include "mozpkix/Input.h"
12 #include "mozpkix/Result.h"
15 class EnterpriseCert
{
17 EnterpriseCert(const uint8_t* data
, size_t len
, bool isRoot
)
18 : mDER(data
, len
), mIsRoot(isRoot
) {}
19 EnterpriseCert(const EnterpriseCert
& other
)
20 : mDER(other
.mDER
.Clone()), mIsRoot(other
.mIsRoot
) {}
21 EnterpriseCert(EnterpriseCert
&& other
)
22 : mDER(std::move(other
.mDER
)), mIsRoot(other
.mIsRoot
) {}
24 void CopyBytes(nsTArray
<uint8_t>& dest
) const;
25 mozilla::pkix::Result
GetInput(mozilla::pkix::Input
& input
) const;
26 bool GetIsRoot() const;
27 // Is this certificate a known, built-in root?
28 bool IsKnownRoot(mozilla::UniqueSECMODModule
& rootsModule
);
31 nsTArray
<uint8_t> mDER
;
35 // This may block and must not be called from the main thread.
36 nsresult
GatherEnterpriseCerts(nsTArray
<EnterpriseCert
>& certs
);
38 #endif // EnterpriseRoots_h