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

Unified Diff: net/test/spawned_test_server/base_test_server.cc

Issue 2100303002: Add OCSPVerifyResult for tracking stapled OCSP responses cross-platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ocsp-date-check
Patch Set: Add tests for REVOKED status Created 4 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 side-by-side diff with in-line comments
Download patch
Index: net/test/spawned_test_server/base_test_server.cc
diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc
index bb4427ac451ff332763ce17821c0ebcd4c6596d9..734ead14d5019d1f27bd792daea963dc1cf61060 100644
--- a/net/test/spawned_test_server/base_test_server.cc
+++ b/net/test/spawned_test_server/base_test_server.cc
@@ -128,6 +128,7 @@ std::unique_ptr<base::ListValue> GetTokenBindingParams(
BaseTestServer::SSLOptions::SSLOptions()
: server_certificate(CERT_OK),
ocsp_status(OCSP_OK),
+ ocsp_date(OCSP_VALID),
cert_serial(0),
request_client_certificate(false),
key_exchanges(SSLOptions::KEY_EXCHANGE_ANY),
@@ -146,6 +147,7 @@ BaseTestServer::SSLOptions::SSLOptions(
BaseTestServer::SSLOptions::ServerCertificate cert)
: server_certificate(cert),
ocsp_status(OCSP_OK),
+ ocsp_date(OCSP_VALID),
cert_serial(0),
request_client_certificate(false),
key_exchanges(SSLOptions::KEY_EXCHANGE_ANY),
@@ -208,6 +210,25 @@ std::string BaseTestServer::SSLOptions::GetOCSPArgument() const {
}
}
+std::string BaseTestServer::SSLOptions::GetOCSPDateArgument() const {
+ if (server_certificate != CERT_AUTO)
+ return std::string();
+
+ switch (ocsp_date) {
+ case OCSP_VALID:
+ return "valid";
+ case OCSP_OLD:
+ return "old";
+ case OCSP_EARLY:
+ return "early";
+ case OCSP_LONG:
+ return "long";
+ default:
+ NOTREACHED();
+ return std::string();
+ }
+}
+
const char BaseTestServer::kLocalhost[] = "127.0.0.1";
BaseTestServer::BaseTestServer(Type type, const std::string& host)
@@ -524,6 +545,10 @@ bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const {
if (!ocsp_arg.empty())
arguments->SetString("ocsp", ocsp_arg);
+ std::string ocsp_date_arg = ssl_options_.GetOCSPDateArgument();
+ if (!ocsp_date_arg.empty())
+ arguments->SetString("ocsp-date", ocsp_date_arg);
+
if (ssl_options_.cert_serial != 0) {
arguments->SetInteger("cert-serial", ssl_options_.cert_serial);
}

Powered by Google App Engine
This is Rietveld 408576698