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

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

Issue 71633002: Convert SignedCertificateClass to be ref_counted, and add an SCTStore in which to store them. Add S… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: few lint fixes 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
« no previous file with comments | « net/cert/signed_certificate_timestamp.cc ('k') | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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/single_log_ct_verifier.h" 5 #include "net/cert/single_log_ct_verifier.h"
6 6
7 #include "net/base/net_errors.h" 7 #include "net/base/net_errors.h"
8 #include "net/base/net_log.h" 8 #include "net/base/net_log.h"
9 #include "net/cert/ct_log_verifier.h" 9 #include "net/cert/ct_log_verifier.h"
10 #include "net/cert/ct_objects_extractor.h" 10 #include "net/cert/ct_objects_extractor.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 base::StringPiece temp(encoded_sct_list); 63 base::StringPiece temp(encoded_sct_list);
64 std::vector<base::StringPiece> sct_list; 64 std::vector<base::StringPiece> sct_list;
65 65
66 if (!ct::DecodeSCTList(&temp, &sct_list)) 66 if (!ct::DecodeSCTList(&temp, &sct_list))
67 return false; 67 return false;
68 68
69 bool verified = false; 69 bool verified = false;
70 for (std::vector<base::StringPiece>::const_iterator it = sct_list.begin(); 70 for (std::vector<base::StringPiece>::const_iterator it = sct_list.begin();
71 it != sct_list.end(); ++it) { 71 it != sct_list.end(); ++it) {
72 base::StringPiece temp_sct(*it); 72 base::StringPiece temp_sct(*it);
73 ct::SignedCertificateTimestamp decoded_sct; 73 scoped_refptr<ct::SignedCertificateTimestamp> decoded_sct;
74 if (!DecodeSignedCertificateTimestamp(&temp_sct, &decoded_sct)) { 74 if (!DecodeSignedCertificateTimestamp(&temp_sct, &decoded_sct)) {
75 // XXX(rsleevi): Should we really just skip over bad SCTs? 75 // XXX(rsleevi): Should we really just skip over bad SCTs?
76 continue; 76 continue;
77 } 77 }
78 // Assume this SCT is untrusted until proven otherwise. 78 // Assume this SCT is untrusted until proven otherwise.
79 result->unverified_scts.push_back(decoded_sct); 79 result->unverified_scts.push_back(decoded_sct);
80 80
81 if (!log_->Verify(expected_entry, decoded_sct)) { 81 if (!log_->Verify(expected_entry, *decoded_sct.get())) {
82 DVLOG(1) << "Unable to verify SCT signature."; 82 DVLOG(1) << "Unable to verify SCT signature.";
83 continue; 83 continue;
84 } 84 }
85 85
86 if (decoded_sct.timestamp + base::TimeDelta::FromSeconds(1) > 86 if (decoded_sct->timestamp + base::TimeDelta::FromSeconds(1) >
87 base::Time::Now()) { 87 base::Time::Now()) {
88 DVLOG(1) << "SCT is from the future!"; 88 DVLOG(1) << "SCT is from the future!";
89 continue; 89 continue;
90 } 90 }
91 91
92 // Proven otherwise - remove. 92 // Proven otherwise - remove.
93 result->unverified_scts.pop_back(); 93 result->unverified_scts.pop_back();
94 result->verified_scts.push_back(decoded_sct); 94 result->verified_scts.push_back(decoded_sct);
95 verified = true; 95 verified = true;
96 } 96 }
97 97
98 return verified; 98 return verified;
99 } 99 }
100 100
101 } // namespace net 101 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/signed_certificate_timestamp.cc ('k') | net/socket/ssl_client_socket_nss.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698