| 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_PINSET_H_ | |
| 6 #define NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PINSET_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 | |
| 13 namespace net { | |
| 14 | |
| 15 namespace transport_security_state { | |
| 16 | |
| 17 // A Pinset represents the data a website would send in a HPKP header. A pinset | |
| 18 // is given a name so that multiple entries in the preload list can reference | |
| 19 // the same pinset. | |
| 20 class Pinset { | |
| 21 public: | |
| 22 Pinset(std::string name, std::string report_uri); | |
| 23 ~Pinset(); | |
| 24 | |
| 25 const std::string& name() const { return name_; } | |
| 26 const std::string& report_uri() const { return report_uri_; } | |
| 27 | |
| 28 const std::vector<std::string>& static_spki_hashes() const { | |
| 29 return static_spki_hashes_; | |
| 30 } | |
| 31 const std::vector<std::string>& bad_static_spki_hashes() const { | |
| 32 return bad_static_spki_hashes_; | |
| 33 } | |
| 34 | |
| 35 // Register a good hash for this pinset. Hashes are referenced by a name, not | |
| 36 // by the actual hash. | |
| 37 void AddStaticSPKIHash(const std::string& hash_name); | |
| 38 | |
| 39 // Register a bad hash for this pinset. Hashes are referenced by a name, not | |
| 40 // by the actual hash. | |
| 41 void AddBadStaticSPKIHash(const std::string& hash_name); | |
| 42 | |
| 43 private: | |
| 44 std::string name_; | |
| 45 std::string report_uri_; | |
| 46 | |
| 47 // These vectors contain names rather than actual hashes. | |
| 48 std::vector<std::string> static_spki_hashes_; | |
| 49 std::vector<std::string> bad_static_spki_hashes_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(Pinset); | |
| 52 }; | |
| 53 | |
| 54 } // namespace transport_security_state | |
| 55 | |
| 56 } // namespace net | |
| 57 | |
| 58 #endif // NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PINSET_H_ | |
| OLD | NEW |