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_objects_extractor.h" | 5 #include "net/cert/ct_objects_extractor.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "net/base/test_data_directory.h" | 8 #include "net/base/test_data_directory.h" |
9 #include "net/cert/ct_log_verifier.h" | 9 #include "net/cert/ct_log_verifier.h" |
10 #include "net/cert/ct_serialization.h" | 10 #include "net/cert/ct_serialization.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 base::StringPiece sct_list_sp(sct_list); | 45 base::StringPiece sct_list_sp(sct_list); |
46 // Make sure the SCT list can be decoded properly | 46 // Make sure the SCT list can be decoded properly |
47 EXPECT_TRUE(DecodeSCTList(&sct_list_sp, &parsed_scts)); | 47 EXPECT_TRUE(DecodeSCTList(&sct_list_sp, &parsed_scts)); |
48 | 48 |
49 EXPECT_TRUE(DecodeSignedCertificateTimestamp(&parsed_scts[0], sct)); | 49 EXPECT_TRUE(DecodeSignedCertificateTimestamp(&parsed_scts[0], sct)); |
50 } | 50 } |
51 | 51 |
52 protected: | 52 protected: |
53 CertificateList precert_chain_; | 53 CertificateList precert_chain_; |
54 scoped_refptr<X509Certificate> test_cert_; | 54 scoped_refptr<X509Certificate> test_cert_; |
55 scoped_refptr<CTLogVerifier> log_; | 55 scoped_refptr<const CTLogVerifier> log_; |
56 }; | 56 }; |
57 | 57 |
58 // Test that an SCT can be extracted and the extracted SCT contains the | 58 // Test that an SCT can be extracted and the extracted SCT contains the |
59 // expected data. | 59 // expected data. |
60 TEST_F(CTObjectsExtractorTest, ExtractEmbeddedSCT) { | 60 TEST_F(CTObjectsExtractorTest, ExtractEmbeddedSCT) { |
61 scoped_refptr<ct::SignedCertificateTimestamp> sct( | 61 scoped_refptr<ct::SignedCertificateTimestamp> sct( |
62 new ct::SignedCertificateTimestamp()); | 62 new ct::SignedCertificateTimestamp()); |
63 ExtractEmbeddedSCT(precert_chain_[0], &sct); | 63 ExtractEmbeddedSCT(precert_chain_[0], &sct); |
64 | 64 |
65 EXPECT_EQ(sct->version, SignedCertificateTimestamp::SCT_VERSION_1); | 65 EXPECT_EQ(sct->version, SignedCertificateTimestamp::SCT_VERSION_1); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 std::string extracted_sct_list; | 173 std::string extracted_sct_list; |
174 // Use test_cert_ for issuer - it is not the correct issuer of |subject_cert|. | 174 // Use test_cert_ for issuer - it is not the correct issuer of |subject_cert|. |
175 EXPECT_FALSE(ct::ExtractSCTListFromOCSPResponse( | 175 EXPECT_FALSE(ct::ExtractSCTListFromOCSPResponse( |
176 test_cert_->os_cert_handle(), subject_cert->serial_number(), | 176 test_cert_->os_cert_handle(), subject_cert->serial_number(), |
177 ocsp_response, &extracted_sct_list)); | 177 ocsp_response, &extracted_sct_list)); |
178 } | 178 } |
179 | 179 |
180 } // namespace ct | 180 } // namespace ct |
181 | 181 |
182 } // namespace net | 182 } // namespace net |
OLD | NEW |