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

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

Issue 67513008: Certificate Transparency: Add the high-level interface for verifying SCTs over multiple logs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merging with master Created 7 years 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
OLDNEW
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_serialization.h" 5 #include "net/cert/ct_serialization.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 return false; 310 return false;
311 } 311 }
312 312
313 if (!input->empty() || result.empty()) 313 if (!input->empty() || result.empty())
314 return false; 314 return false;
315 output->swap(result); 315 output->swap(result);
316 return true; 316 return true;
317 } 317 }
318 318
319 bool DecodeSignedCertificateTimestamp(base::StringPiece* input, 319 bool DecodeSignedCertificateTimestamp(base::StringPiece* input,
320 scoped_refptr<SignedCertificateTimestamp>* output) { 320 scoped_refptr<SignedCertificateTimestamp>* output) {
wtc 2013/11/25 23:15:50 The function's two parameters should be aligned. (
Eran M. (Google) 2013/11/26 10:10:24 Done.
321 scoped_refptr<SignedCertificateTimestamp> result( 321 scoped_refptr<SignedCertificateTimestamp> result(
322 new SignedCertificateTimestamp()); 322 new SignedCertificateTimestamp());
323 unsigned version; 323 unsigned version;
324 if (!ReadUint(kVersionLength, input, &version)) 324 if (!ReadUint(kVersionLength, input, &version))
325 return false; 325 return false;
326 if (version != SignedCertificateTimestamp::SCT_VERSION_1) { 326 if (version != SignedCertificateTimestamp::SCT_VERSION_1) {
327 DVLOG(1) << "Unsupported/invalid version " << version; 327 DVLOG(1) << "Unsupported/invalid version " << version;
328 return false; 328 return false;
329 } 329 }
330 330
(...skipping 17 matching lines...) Expand all
348 log_id.CopyToString(&result->log_id); 348 log_id.CopyToString(&result->log_id);
349 extensions.CopyToString(&result->extensions); 349 extensions.CopyToString(&result->extensions);
350 result->timestamp = 350 result->timestamp =
351 base::Time::UnixEpoch() + 351 base::Time::UnixEpoch() +
352 base::TimeDelta::FromMilliseconds(static_cast<int64>(timestamp)); 352 base::TimeDelta::FromMilliseconds(static_cast<int64>(timestamp));
353 353
354 output->swap(result); 354 output->swap(result);
355 return true; 355 return true;
356 } 356 }
357 357
358 bool EncodeSCTListForTesting(const base::StringPiece& sct,
359 std::string* output) {
360 std::string encoded_sct;
361 return WriteVariableBytes(kSerializedSCTLengthBytes, sct, &encoded_sct) &&
362 WriteVariableBytes(kSCTListLengthBytes, encoded_sct, output);
363 }
364
358 } // namespace ct 365 } // namespace ct
359 366
360 } // namespace net 367 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698