| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright (c) 2016 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 | 
|  | 5 #ifndef NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PINSETS_H_ | 
|  | 6 #define NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PINSETS_H_ | 
|  | 7 | 
|  | 8 #include <map> | 
|  | 9 #include <memory> | 
|  | 10 #include <string> | 
|  | 11 | 
|  | 12 #include "base/macros.h" | 
|  | 13 #include "base/strings/string_piece.h" | 
|  | 14 #include "net/tools/domain_security_preload_generator/cert_util.h" | 
|  | 15 #include "net/tools/domain_security_preload_generator/pinset.h" | 
|  | 16 #include "net/tools/domain_security_preload_generator/pinsets.h" | 
|  | 17 #include "net/tools/domain_security_preload_generator/spki_hash.h" | 
|  | 18 | 
|  | 19 namespace net { | 
|  | 20 | 
|  | 21 namespace transport_security_state { | 
|  | 22 | 
|  | 23 // Contains SPKIHashes and their names. The names are used to reference | 
|  | 24 // the hashes from Pinset's. | 
|  | 25 using SPKIHashMap = std::map<std::string, SPKIHash>; | 
|  | 26 using PinsetMap = std::map<std::string, std::unique_ptr<Pinset>>; | 
|  | 27 | 
|  | 28 class Pinsets { | 
|  | 29  public: | 
|  | 30   Pinsets(); | 
|  | 31   ~Pinsets(); | 
|  | 32 | 
|  | 33   void RegisterSPKIHash(base::StringPiece name, const SPKIHash& hash); | 
|  | 34   void RegisterPinset(std::unique_ptr<Pinset> set); | 
|  | 35 | 
|  | 36   size_t size() const { return pinsets_.size(); } | 
|  | 37   size_t spki_size() const { return spki_hashes_.size(); } | 
|  | 38 | 
|  | 39   const SPKIHashMap& spki_hashes() const { return spki_hashes_; } | 
|  | 40   const PinsetMap& pinsets() const { return pinsets_; } | 
|  | 41 | 
|  | 42  private: | 
|  | 43   // Contains all SPKI hashes found in the input pins file. | 
|  | 44   SPKIHashMap spki_hashes_; | 
|  | 45 | 
|  | 46   // Contains all pinsets in the input JSON file. | 
|  | 47   PinsetMap pinsets_; | 
|  | 48 | 
|  | 49   DISALLOW_COPY_AND_ASSIGN(Pinsets); | 
|  | 50 }; | 
|  | 51 | 
|  | 52 }  // namespace transport_security_state | 
|  | 53 | 
|  | 54 }  // namespace net | 
|  | 55 | 
|  | 56 #endif  // NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PINSETS_H_ | 
| OLD | NEW | 
|---|