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

Side by Side Diff: net/cert/ct_objects_extractor_unittest.cc

Issue 27026002: CT: Adding preliminary Certificate Transparency support to Chromium. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Distinguish between SCTs from unknown logs and unverified ones Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/cert/ct_objects_extractor_openssl.cc ('k') | net/cert/ct_serialization_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/cert/ct_objects_extractor.h"
6
7 #include "base/files/file_path.h"
8 #include "net/base/test_data_directory.h"
9 #include "net/cert/ct_serialization.h"
10 #include "net/cert/signed_certificate_timestamp.h"
11 #include "net/cert/x509_certificate.h"
12 #include "net/test/cert_test_util.h"
13 #include "net/test/ct_test_util.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15
16 namespace net {
17
18 namespace ct {
19
20 class CTObjectsExtractorTest : public ::testing::Test {
21 public:
22 virtual void SetUp() OVERRIDE {
23 certs_ = CreateCertificateListFromFile(
24 GetTestCertsDirectory(), "ct-test-embedded-cert.pem",
25 X509Certificate::FORMAT_AUTO);
26 ASSERT_EQ(2u, certs_.size());
27 }
28
29 protected:
30 CertificateList certs_;
31 int blah_;
32 };
33
34 TEST_F(CTObjectsExtractorTest, ExtractEmbeddedSCT) {
35 std::string sct_list;
36 EXPECT_TRUE(ExtractEmbeddedSCTs(certs_[0]->os_cert_handle(), &sct_list));
37
38 std::vector<base::StringPiece> parsed_scts;
39 base::StringPiece sct_list_sp(sct_list);
40 // Make sure the SCTs list can be decoded properly
41 EXPECT_TRUE(DecodeSCTList(&sct_list_sp, &parsed_scts));
42
43 // And the signature data is the expected value.
44 ct::SignedCertificateTimestamp sct;
45 EXPECT_TRUE(DecodeSignedCertificateTimestamp(&(parsed_scts[0]), &sct));
46
47 EXPECT_EQ(sct.version, SignedCertificateTimestamp::SCT_VERSION_1);
48 EXPECT_EQ(ct::GetTestPublicKeyId(), sct.log_id);
49 }
50
51 TEST_F(CTObjectsExtractorTest, ExtractPrecert) {
52 LogEntry entry;
53 ASSERT_TRUE(GetPrecertLogEntry(certs_[0]->os_cert_handle(),
54 certs_[1]->os_cert_handle(),
55 &entry));
56
57 // XXX(rsleevi): Add KAT for the Precert data.
58 }
59
60 // XXX(eranm): Test that the extracted SCT is the expected one
61 // XXX(eranm): Test that the embedded SCT verifies
62 // XXX(eranm): Test that an externally-provided SCT verifies over the LogEntry
63 // of a regular X.509 Certificate
64
65 } // namespace ct
66
67 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/ct_objects_extractor_openssl.cc ('k') | net/cert/ct_serialization_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698