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

Unified Diff: components/certificate_transparency/log_proof_fetcher.h

Issue 1405293009: Certificate Transparency: Fetching consistency proofs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on Android Created 5 years, 1 month 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: components/certificate_transparency/log_proof_fetcher.h
diff --git a/components/certificate_transparency/log_proof_fetcher.h b/components/certificate_transparency/log_proof_fetcher.h
index ba952e365d6f77177184a9c70648e2b9f6ef6b09..39f13c4543b30154603fd5d1cf091cc6fad4fba1 100644
--- a/components/certificate_transparency/log_proof_fetcher.h
+++ b/components/certificate_transparency/log_proof_fetcher.h
@@ -53,6 +53,14 @@ class LogProofFetcher : public net::URLRequest::Delegate {
using FetchFailedCallback = base::Callback<
void(const std::string& log_id, int net_error, int http_response_code)>;
+ // Callback for successful retrieval of consistency proofs between two
+ // STHs. Called with the log_id of the log the consistency belongs to (as
+ // supplied by the caller to FetchConsistencyProof) and the vector of
+ // proof nodes.
+ using ConsistencyProofFetchedCallback =
+ base::Callback<void(const std::string& log_id,
+ const std::vector<std::string>& consistency_proof)>;
mmenke 2015/11/18 19:25:15 include <vector>
Eran Messeri 2015/11/24 22:53:38 Done.
+
explicit LogProofFetcher(net::URLRequestContext* request_context);
~LogProofFetcher() override;
@@ -73,6 +81,20 @@ class LogProofFetcher : public net::URLRequest::Delegate {
const SignedTreeHeadFetchedCallback& fetched_callback,
const FetchFailedCallback& failed_callback);
+ // Fetch a consistency proof between the Merkle trees identified by
+ // |old_tree_size| and |new_tree_size| of the log identified by |log_id|
+ // from |base_log_url|.
+ //
+ // See the documentation of FetchSignedTreeHead regarding request destruction
+ // and multiple requests to the same log.
+ void FetchConsistencyProof(
+ const GURL& base_log_url,
mmenke 2015/11/18 19:25:15 include url/gurl.h
Eran Messeri 2015/11/24 22:53:38 Done.
+ const std::string& log_id,
+ size_t old_tree_size,
+ size_t new_tree_size,
+ const ConsistencyProofFetchedCallback& fetched_callback,
+ const FetchFailedCallback& failed_callback);
+
// net::URLRequest::Delegate
void OnResponseStarted(net::URLRequest* request) override;
void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
@@ -107,6 +129,15 @@ class LogProofFetcher : public net::URLRequest::Delegate {
scoped_ptr<base::Value> parsed_json);
void OnSTHJsonParseError(net::URLRequest* request, const std::string& error);
+ // Callbacks for parsing the consistency proof's JSON by the SafeJsonParser
+ void OnConsistencyProofJsonParseSuccess(net::URLRequest* request,
+ scoped_ptr<base::Value> parsed_json);
+ void OnConsistencyProofJsonParseError(net::URLRequest* request,
+ const std::string& error);
+
+ // Creates a new URLRequest with the right flags for log requests.
+ net::URLRequest* CreateRequest(const GURL& url);
mmenke 2015/11/18 19:25:15 make this return a scoped_ptr, to make ownership s
Eran Messeri 2015/11/24 22:53:38 Obsolete - to avoid code duplication the code in t
+
net::URLRequestContext* const request_context_;
// Owns the contained requests, as well as FetchState.

Powered by Google App Engine
This is Rietveld 408576698