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

Side by Side Diff: chromeos/network/network_certificate_handler.h

Issue 2891453002: Introduce networkingPrivate.getCertificateLists (Closed)
Patch Set: Clang format Created 3 years, 6 months 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
« no previous file with comments | « chromeos/network/client_cert_util.cc ('k') | chromeos/network/network_certificate_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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 CHROMEOS_NETWORK_NETWORK_CERTIFICATE_HANDLER_H_
6 #define CHROMEOS_NETWORK_NETWORK_CERTIFICATE_HANDLER_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "chromeos/cert_loader.h"
12 #include "chromeos/chromeos_export.h"
13
14 namespace chromeos {
15
16 // This class maintains user and server CA certificate lists for network
17 // configuration UI.
18 class CHROMEOS_EXPORT NetworkCertificateHandler : public CertLoader::Observer {
19 public:
20 class Observer {
21 public:
22 virtual ~Observer() {}
23
24 // Called for any Observers whenever the certificates are loaded and any
25 // time the certificate lists change.
26 virtual void OnCertificatesChanged() = 0;
27
28 protected:
29 Observer() {}
30
31 private:
32 DISALLOW_COPY_AND_ASSIGN(Observer);
33 };
34
35 struct Certificate {
36 Certificate();
37 ~Certificate();
38 Certificate(const Certificate& other);
39
40 // A net::HashValue result used to uniquely identify certificates.
41 std::string hash;
42
43 // The X509 certificate issuer common name.
44 std::string issued_by;
45
46 // The X509 certificate common name or nickname.
47 std::string issued_to;
48
49 // The common name or nickname in Internationalized Domain Name format.
50 std::string issued_to_ascii;
51
52 // The PEM for Server CA certificates.
53 std::string pem;
54
55 // The PKCS#11 identifier in slot:id format for user certificates.
56 std::string pkcs11_id;
57
58 // True if a user certificate is stored in a hardware slot.
59 bool hardware_backed = false;
60 };
61
62 NetworkCertificateHandler();
63 ~NetworkCertificateHandler() override;
64
65 void AddObserver(Observer* observer);
66 void RemoveObserver(Observer* observer);
67
68 const std::vector<Certificate>& server_ca_certificates() const {
69 return server_ca_certificates_;
70 }
71 const std::vector<Certificate>& user_certificates() const {
72 return user_certificates_;
73 }
74
75 void SetCertificatesForTest(const net::CertificateList& cert_list);
76 void NotifyCertificatsChangedForTest();
77
78 private:
79 // CertLoader::Observer
80 void OnCertificatesLoaded(const net::CertificateList& cert_list,
81 bool initial_load) override;
82
83 void ProcessCertificates(const net::CertificateList& cert_list);
84
85 base::ObserverList<NetworkCertificateHandler::Observer> observer_list_;
86
87 std::vector<Certificate> server_ca_certificates_;
88 std::vector<Certificate> user_certificates_;
89
90 DISALLOW_COPY_AND_ASSIGN(NetworkCertificateHandler);
91 };
92
93 } // namespace chromeos
94
95 #endif // CHROMEOS_NETWORK_NETWORK_CERTIFICATE_HANDLER_H_
OLDNEW
« no previous file with comments | « chromeos/network/client_cert_util.cc ('k') | chromeos/network/network_certificate_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698