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

Unified Diff: net/test/ct_test_util.cc

Issue 1498983004: CT Verify test utilities change - Moved the following common functions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « net/test/ct_test_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/test/ct_test_util.cc
diff --git a/net/test/ct_test_util.cc b/net/test/ct_test_util.cc
index 3bd30ff41351b51b49f2a8cf614a85b1efb9a2a7..2ad827d5c15e0f9dac87ba547abeda8089677525 100644
--- a/net/test/ct_test_util.cc
+++ b/net/test/ct_test_util.cc
@@ -14,7 +14,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "net/cert/ct_serialization.h"
-#include "net/cert/signed_certificate_timestamp.h"
+#include "net/cert/ct_verify_result.h"
#include "net/cert/signed_tree_head.h"
#include "net/cert/x509_certificate.h"
@@ -329,6 +329,38 @@ std::string CreateConsistencyProofJsonString(
return consistency_proof_json;
}
+std::string GetSCTListForTesting() {
+ const std::string sct = ct::GetTestSignedCertificateTimestamp();
+ std::string sct_list;
+ ct::EncodeSCTListForTesting(sct, &sct_list);
+ return sct_list;
+}
+
+std::string GetSCTListWithInvalidSCT() {
+ std::string sct(ct::GetTestSignedCertificateTimestamp());
+
+ // Change a byte inside the Log ID part of the SCT so it does not match the
+ // log used in the tests.
+ sct[15] = 't';
+
+ std::string sct_list;
+ ct::EncodeSCTListForTesting(sct, &sct_list);
+ return sct_list;
+}
+
+bool CheckForSingleVerifiedSCTInResult(const ct::CTVerifyResult& result,
+ const std::string& log_description) {
+ return (result.verified_scts.size() == 1U) && result.invalid_scts.empty() &&
+ result.unknown_logs_scts.empty() &&
+ result.verified_scts[0]->log_description == log_description;
+}
+
+bool CheckForSCTOrigin(const ct::CTVerifyResult& result,
+ ct::SignedCertificateTimestamp::Origin origin) {
+ return (result.verified_scts.size() > 0) &&
+ (result.verified_scts[0]->origin == origin);
+}
+
} // namespace ct
} // namespace net
« no previous file with comments | « net/test/ct_test_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698