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

Unified Diff: net/cert/ct_serialization.cc

Issue 2957063005: Reland of Update SCT serialization format in Expect-CT reports (Closed)
Patch Set: fix reinterpret_cast Created 3 years, 6 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/ct_serialization.cc
diff --git a/net/cert/ct_serialization.cc b/net/cert/ct_serialization.cc
index 7bc7083815e56cc2f94fd66d7e44b2361725321e..ff843d0a2abfa8704ece739f49a5130ac97f9d57 100644
--- a/net/cert/ct_serialization.cc
+++ b/net/cert/ct_serialization.cc
@@ -428,6 +428,22 @@ bool DecodeSignedCertificateTimestamp(
return true;
}
+void EncodeSignedCertificateTimestamp(
+ const scoped_refptr<ct::SignedCertificateTimestamp>& input,
+ std::string* output) {
+ // This function only supports serialization of V1 SCTs.
+ DCHECK_EQ(SignedCertificateTimestamp::V1, input->version);
+ WriteUint(kVersionLength, input->version, output);
+ DCHECK_EQ(kLogIdLength, input->log_id.size());
+ WriteEncodedBytes(
+ base::StringPiece(reinterpret_cast<const char*>(input->log_id.data()),
+ kLogIdLength),
+ output);
+ WriteTimeSinceEpoch(input->timestamp, output);
+ WriteVariableBytes(kExtensionsLengthBytes, input->extensions, output);
+ EncodeDigitallySigned(input->signature, output);
+}
+
bool EncodeSCTListForTesting(const base::StringPiece& sct,
std::string* output) {
std::string encoded_sct;
« 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