Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: net/tools/domain_security_preload_generator/pinsets.h

Issue 2551153003: Add static domain security state generator tool. (Closed)
Patch Set: Fix iOS? Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW
« no previous file with comments | « net/tools/domain_security_preload_generator/pinset.cc ('k') | net/tools/domain_security_preload_generator/pinsets.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698