OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/cert/ct_log_verifier.h" | 5 #include "net/cert/ct_log_verifier.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "net/cert/signed_certificate_timestamp.h" | 10 #include "net/cert/signed_certificate_timestamp.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ASSERT_TRUE(log_->SetSignedTreeHead(sth.Pass())); | 82 ASSERT_TRUE(log_->SetSignedTreeHead(sth.Pass())); |
83 } | 83 } |
84 | 84 |
85 TEST_F(CTLogVerifierTest, DoesNotSetInvalidSTH) { | 85 TEST_F(CTLogVerifierTest, DoesNotSetInvalidSTH) { |
86 scoped_ptr<ct::SignedTreeHead> sth(new ct::SignedTreeHead()); | 86 scoped_ptr<ct::SignedTreeHead> sth(new ct::SignedTreeHead()); |
87 ct::GetSignedTreeHead(sth.get()); | 87 ct::GetSignedTreeHead(sth.get()); |
88 sth->sha256_root_hash[0] = '\x0'; | 88 sth->sha256_root_hash[0] = '\x0'; |
89 ASSERT_FALSE(log_->SetSignedTreeHead(sth.Pass())); | 89 ASSERT_FALSE(log_->SetSignedTreeHead(sth.Pass())); |
90 } | 90 } |
91 | 91 |
| 92 // Test that excess data after the public key is rejected. |
| 93 TEST_F(CTLogVerifierTest, ExcessDataInPublicKey) { |
| 94 std::string key = ct::GetTestPublicKey(); |
| 95 key += "extra"; |
| 96 |
| 97 scoped_ptr<CTLogVerifier> log = CTLogVerifier::Create(key, "testlog"); |
| 98 EXPECT_FALSE(log); |
| 99 } |
| 100 |
92 } // namespace net | 101 } // namespace net |
OLD | NEW |