Chromium Code Reviews| Index: net/cert/signed_certificate_timestamp.cc |
| diff --git a/net/cert/signed_certificate_timestamp.cc b/net/cert/signed_certificate_timestamp.cc |
| index 8925a994c123ba146f30bfd2bb8c8cd5fa4d975a..31d3415ccf3ae76dd4e6c03f2f80ee24b7d1b2ea 100644 |
| --- a/net/cert/signed_certificate_timestamp.cc |
| +++ b/net/cert/signed_certificate_timestamp.cc |
| @@ -4,6 +4,8 @@ |
| #include "net/cert/signed_certificate_timestamp.h" |
| +#include "base/pickle.h" |
| + |
| namespace net { |
| namespace ct { |
| @@ -28,6 +30,48 @@ SignedCertificateTimestamp::SignedCertificateTimestamp() {} |
| SignedCertificateTimestamp::~SignedCertificateTimestamp() {} |
| +void SignedCertificateTimestamp::Persist(Pickle* pickle) { |
| + CHECK(pickle->WriteInt(version)); |
| + CHECK(pickle->WriteString(log_id)); |
| + CHECK(pickle->WriteInt64(timestamp.ToInternalValue())); |
| + CHECK(pickle->WriteString(extensions)); |
| + CHECK(pickle->WriteInt(signature.hash_algorithm)); |
| + CHECK(pickle->WriteInt(signature.signature_algorithm)); |
| + CHECK(pickle->WriteString(signature.signature_data)); |
| +} |
| + |
| +// static |
| +SignedCertificateTimestamp* |
| +SignedCertificateTimestamp::CreateFromPickle(PickleIterator* iter) { |
| + int version; |
| + std::string log_id; |
| + int64 timestamp; |
| + std::string extensions; |
| + int hash_algorithm; |
| + int sig_algorithm; |
| + std::string sig_data; |
|
wtc
2013/11/27 16:32:41
Nit: you can store the new SignedCertificateTimest
wtc
2013/11/27 17:29:18
I just realized that SignedCertificateTimestamp is
alcutter
2013/11/27 18:05:55
That occurred to me too, but I thought the split o
alcutter
2013/11/27 18:05:55
Ah, I'd assumed you meant a scoped_refptr in the o
wtc
2013/11/28 01:28:02
The new convention in Chromium seems to recommend
alcutter
2013/11/28 12:08:19
Ack.
|
| + if (!(iter->ReadInt(&version) && |
| + iter->ReadString(&log_id) && |
| + iter->ReadInt64(×tamp) && |
| + iter->ReadString(&extensions) && |
| + iter->ReadInt(&hash_algorithm) && |
| + iter->ReadInt(&sig_algorithm) && |
| + iter->ReadString(&sig_data))) { |
| + return NULL; |
| + } |
| + SignedCertificateTimestamp* sct(new SignedCertificateTimestamp()); |
| + sct->version = static_cast<Version>(version); |
| + sct->log_id = log_id; |
| + sct->timestamp = base::Time::FromInternalValue(timestamp); |
| + sct->extensions = extensions; |
| + sct->signature.hash_algorithm = |
| + static_cast<DigitallySigned::HashAlgorithm>(hash_algorithm); |
| + sct->signature.signature_algorithm = |
| + static_cast<DigitallySigned::SignatureAlgorithm>(sig_algorithm); |
| + sct->signature.signature_data = sig_data; |
| + return sct; |
| +} |
| + |
| LogEntry::LogEntry() {} |
| LogEntry::~LogEntry() {} |