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

Unified Diff: net/cert/ct_log_verifier_unittest.cc

Issue 230713002: Certificate Transparency: Parse Signed Tree Heads and validate them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing more of Ryan's comments Created 6 years, 7 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 | « net/cert/ct_log_verifier_openssl.cc ('k') | net/cert/ct_serialization.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/ct_log_verifier_unittest.cc
diff --git a/net/cert/ct_log_verifier_unittest.cc b/net/cert/ct_log_verifier_unittest.cc
index b94f14a11c2f79fd054761460e20db37988d91e7..9b3211df2e04400449bbd12f38e1e5999b5e0826 100644
--- a/net/cert/ct_log_verifier_unittest.cc
+++ b/net/cert/ct_log_verifier_unittest.cc
@@ -8,6 +8,7 @@
#include "base/time/time.h"
#include "net/cert/signed_certificate_timestamp.h"
+#include "net/cert/signed_tree_head.h"
#include "net/test/ct_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -75,4 +76,17 @@ TEST_F(CTLogVerifierTest, FailsInvalidLogID) {
EXPECT_FALSE(log_->Verify(cert_entry, *cert_sct));
}
+TEST_F(CTLogVerifierTest, SetsValidSTH) {
+ scoped_ptr<ct::SignedTreeHead> sth(new ct::SignedTreeHead());
+ ct::GetSignedTreeHead(sth.get());
+ ASSERT_TRUE(log_->SetSignedTreeHead(sth.Pass()));
+}
+
+TEST_F(CTLogVerifierTest, DoesNotSetInvalidSTH) {
+ scoped_ptr<ct::SignedTreeHead> sth(new ct::SignedTreeHead());
+ ct::GetSignedTreeHead(sth.get());
+ sth->sha256_root_hash[0] = '\x0';
+ ASSERT_FALSE(log_->SetSignedTreeHead(sth.Pass()));
+}
+
} // namespace net
« no previous file with comments | « net/cert/ct_log_verifier_openssl.cc ('k') | net/cert/ct_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698