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

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

Issue 2960163002: Revert of Update SCT serialization format in Expect-CT reports (Closed)
Patch Set: Created 3 years, 5 months 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/ct_serialization.h ('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
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 !DecodeDigitallySigned(input, &result->signature)) { 421 !DecodeDigitallySigned(input, &result->signature)) {
422 return false; 422 return false;
423 } 423 }
424 424
425 log_id.CopyToString(&result->log_id); 425 log_id.CopyToString(&result->log_id);
426 extensions.CopyToString(&result->extensions); 426 extensions.CopyToString(&result->extensions);
427 output->swap(result); 427 output->swap(result);
428 return true; 428 return true;
429 } 429 }
430 430
431 void EncodeSignedCertificateTimestamp(
432 const scoped_refptr<ct::SignedCertificateTimestamp>& input,
433 std::string* output) {
434 // This function only supports serialization of V1 SCTs.
435 DCHECK_EQ(SignedCertificateTimestamp::V1, input->version);
436 WriteUint(kVersionLength, input->version, output);
437 WriteEncodedBytes(
438 base::StringPiece(reinterpret_cast<const char*>(input->log_id.data()),
439 kLogIdLength),
440 output);
441 WriteTimeSinceEpoch(input->timestamp, output);
442 WriteVariableBytes(kExtensionsLengthBytes, input->extensions, output);
443 EncodeDigitallySigned(input->signature, output);
444 }
445
446 bool EncodeSCTListForTesting(const base::StringPiece& sct, 431 bool EncodeSCTListForTesting(const base::StringPiece& sct,
447 std::string* output) { 432 std::string* output) {
448 std::string encoded_sct; 433 std::string encoded_sct;
449 return WriteVariableBytes(kSerializedSCTLengthBytes, sct, &encoded_sct) && 434 return WriteVariableBytes(kSerializedSCTLengthBytes, sct, &encoded_sct) &&
450 WriteVariableBytes(kSCTListLengthBytes, encoded_sct, output); 435 WriteVariableBytes(kSCTListLengthBytes, encoded_sct, output);
451 } 436 }
452 437
453 } // namespace ct 438 } // namespace ct
454 439
455 } // namespace net 440 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/ct_serialization.h ('k') | net/cert/ct_serialization_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698