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

Unified Diff: net/cert/cert_verifier_cache_persister.h

Issue 1892033002: Cert - protobufs to serialize and deserialize CertVerifierCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: net/cert/cert_verifier_cache_persister.h
diff --git a/net/cert/cert_verifier_cache_persister.h b/net/cert/cert_verifier_cache_persister.h
new file mode 100644
index 0000000000000000000000000000000000000000..b732452804174d036b229c869f044a4db2b20b9d
--- /dev/null
+++ b/net/cert/cert_verifier_cache_persister.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// CertVerifierCachePersister maintains an in memory database containing the
+// list of hosts whose cerificates have been verified. This singleton object
+// deals with writing that data out to disk as needed and loading it at startup.
+//
+// At startup we need to load the certificate verification results from the
+// disk and we deserialize the data and then pouplate
+// MultiThreadedCertVerifier's cache.
+//
+// At shutdown, we serialize MultiThreadedCertVerifier's cache and then write
+// that data to disk.
+
+#ifndef NET_CERT_CERT_VERIFIER_CACHE_PERSISTER_H_
+#define NET_CERT_CERT_VERIFIER_CACHE_PERSISTER_H_
+
+#include <string>
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "base/macros.h"
+#include "net/base/net_export.h"
+
+namespace net {
+
+class MultiThreadedCertVerifier;
+
+class NET_EXPORT_PRIVATE CertVerifierCachePersister {
+ public:
+ typedef std::vector<std::string> CertVector;
+
+ CertVerifierCachePersister(MultiThreadedCertVerifier* verifier);
+ ~CertVerifierCachePersister();
+
+ // Recursively iterate over this |verifier_|'s |cache_| and all children and
+ // write the hierarchical structure into |data|.
+ void SerializeCache(std::string* data);
+
+ // Populates MultiThreadedCertVerifier's |cache_|. Returns true if the |data|
+ // is deserialized correctly.
+ bool LoadCache(const std::string& data);
+
+ private:
+ // |verifier_| whose |cache_| will be serialized/deserialized.
+ MultiThreadedCertVerifier* verifier_;
+
+ DISALLOW_COPY_AND_ASSIGN(CertVerifierCachePersister);
+};
+
+} // namespace net
+
+#endif // NET_CERT_CERT_VERIFIER_CACHE_PERSISTER_H_

Powered by Google App Engine
This is Rietveld 408576698