tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

EnterpriseRoots.h (1265B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
      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/. */
      6 
      7 #ifndef EnterpriseRoots_h
      8 #define EnterpriseRoots_h
      9 
     10 #include "ScopedNSSTypes.h"
     11 #include "mozpkix/Input.h"
     12 #include "mozpkix/Result.h"
     13 #include "nsTArray.h"
     14 
     15 class EnterpriseCert {
     16 public:
     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) {}
     23 
     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);
     29 
     30 private:
     31  nsTArray<uint8_t> mDER;
     32  bool mIsRoot;
     33 };
     34 
     35 // This may block and must not be called from the main thread.
     36 nsresult GatherEnterpriseCerts(nsTArray<EnterpriseCert>& certs);
     37 
     38 #endif  // EnterpriseRoots_h