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

Unified Diff: chrome/browser/net/packed_ct_ev_whitelist.h

Issue 811353002: Move CT EV white list packaging API from chrome/ to components/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed missed nit Created 5 years, 11 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
« no previous file with comments | « chrome/browser/net/bit_stream_reader_unittest.cc ('k') | chrome/browser/net/packed_ct_ev_whitelist.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/packed_ct_ev_whitelist.h
diff --git a/chrome/browser/net/packed_ct_ev_whitelist.h b/chrome/browser/net/packed_ct_ev_whitelist.h
deleted file mode 100644
index 6520f3ffff7ffe68e0a40298d703dbbece664a21..0000000000000000000000000000000000000000
--- a/chrome/browser/net/packed_ct_ev_whitelist.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2014 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.
-
-#ifndef CHROME_BROWSER_NET_PACKED_CT_EV_WHITELIST_H_
-#define CHROME_BROWSER_NET_PACKED_CT_EV_WHITELIST_H_
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include "base/gtest_prod_util.h"
-#include "base/version.h"
-#include "net/cert/ct_ev_whitelist.h"
-
-namespace base {
-class FilePath;
-}
-
-// An implementation of the EVCertsWhitelist that gets its data packed using
-// Golomb coding to encode the difference between subsequent hash values.
-// Format of the packed list:
-// * First 8 bytes: First hash
-// * Repeating Golomb-coded number which is the numeric difference of the
-// previous hash value from this one
-//
-// The resulting, unpacked list is a sorted list of hash values that can be
-// efficiently searched.
-class PackedEVCertsWhitelist : public net::ct::EVCertsWhitelist {
- public:
- // Unpacks the given |compressed_whitelist|. See the class documentation
- // for description of the |compressed_whitelist| format.
- PackedEVCertsWhitelist(const std::string& compressed_whitelist,
- const base::Version& version);
-
- // Returns true if the |certificate_hash| appears in the EV certificate hashes
- // whitelist. Must not be called if IsValid for this instance returned false.
- bool ContainsCertificateHash(
- const std::string& certificate_hash) const override;
-
- // Returns true if the EV certificate hashes whitelist provided in the c'tor
- // was valid, false otherwise.
- bool IsValid() const override;
-
- // Returns the version of the whitelist in use, if available.
- base::Version Version() const override;
-
- protected:
- ~PackedEVCertsWhitelist() override;
-
- private:
- FRIEND_TEST_ALL_PREFIXES(PackedEVCertsWhitelistTest,
- UncompressFailsForTooShortList);
- FRIEND_TEST_ALL_PREFIXES(PackedEVCertsWhitelistTest,
- UncompressFailsForTruncatedList);
- FRIEND_TEST_ALL_PREFIXES(PackedEVCertsWhitelistTest,
- UncompressFailsForInvalidValuesInList);
- FRIEND_TEST_ALL_PREFIXES(PackedEVCertsWhitelistTest,
- UncompressesWhitelistCorrectly);
-
- // Given a Golomb-coded list of hashes in |compressed_whitelist|, unpack into
- // |uncompressed_list|. Returns true if the format of the compressed whitelist
- // is valid, false otherwise.
- static bool UncompressEVWhitelist(const std::string& compressed_whitelist,
- std::vector<uint64_t>* uncompressed_list);
-
- // The whitelist is an array containing certificate hashes (truncated
- // to a fixed size of 8 bytes), sorted.
- // Binary search is used to locate hashes in the the array.
- // Benchmarking bsearch vs std::set (with 120K entries, doing 1.2M lookups)
- // shows that bsearch is about twice as fast as std::set lookups (and std::set
- // has additional memory overhead).
- std::vector<uint64_t> whitelist_;
- base::Version version_;
-
- DISALLOW_COPY_AND_ASSIGN(PackedEVCertsWhitelist);
-};
-
-// Sets the EV certificate hashes whitelist in the SSLConfigService
-// to the provided |whitelist|, if valid. Otherwise, does nothing.
-// To set the new whitelist, this function dispatches a task to the IO thread.
-void SetEVCertsWhitelist(scoped_refptr<net::ct::EVCertsWhitelist> whitelist);
-
-#endif // CHROME_BROWSER_NET_PACKED_CT_EV_WHITELIST_H_
« no previous file with comments | « chrome/browser/net/bit_stream_reader_unittest.cc ('k') | chrome/browser/net/packed_ct_ev_whitelist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698