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

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 base64 issue and accidental replace. 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 // Contains SPKIHashes and their name. The names are used to reference
22 // the hashes from Pinset's.
23 using SPKIHashMap = std::map<std::string, SPKIHash>;
24 using PinsetMap = std::map<std::string, std::unique_ptr<Pinset>>;
25
26 class Pinsets {
27 public:
28 Pinsets();
29 ~Pinsets();
30
31 void RegisterSPKIHash(base::StringPiece name, const SPKIHash& hash);
32 void RegisterPinset(std::unique_ptr<Pinset> set);
33
34 size_t size() const { return pinsets_.size(); }
35 size_t spki_size() const { return spki_hashes_.size(); }
36
37 const SPKIHashMap& spki_hashes() const { return spki_hashes_; }
38 const PinsetMap& pinsets() const { return pinsets_; }
39
40 private:
41 // Contains all SPKI hashes found in the input pins file.
42 SPKIHashMap spki_hashes_;
43
44 // Contains all pinsets in the input JSON file.
45 PinsetMap pinsets_;
46
47 DISALLOW_COPY_AND_ASSIGN(Pinsets);
48 };
49
50 } // namespace net
51
52 #endif // NET_TOOLS_DOMAIN_SECURITY_PRELOAD_GENERATOR_PINSETS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698