OLD | NEW |
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/signed_certificate_timestamp.h" | 5 #include "net/cert/signed_certificate_timestamp.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 return lhs->extensions < rhs->extensions; | 25 return lhs->extensions < rhs->extensions; |
26 if (lhs->origin != rhs->origin) | 26 if (lhs->origin != rhs->origin) |
27 return lhs->origin < rhs->origin; | 27 return lhs->origin < rhs->origin; |
28 return lhs->version < rhs->version; | 28 return lhs->version < rhs->version; |
29 } | 29 } |
30 | 30 |
31 SignedCertificateTimestamp::SignedCertificateTimestamp() {} | 31 SignedCertificateTimestamp::SignedCertificateTimestamp() {} |
32 | 32 |
33 SignedCertificateTimestamp::~SignedCertificateTimestamp() {} | 33 SignedCertificateTimestamp::~SignedCertificateTimestamp() {} |
34 | 34 |
35 void SignedCertificateTimestamp::Persist(Pickle* pickle) { | 35 void SignedCertificateTimestamp::Persist(base::Pickle* pickle) { |
36 CHECK(pickle->WriteInt(version)); | 36 CHECK(pickle->WriteInt(version)); |
37 CHECK(pickle->WriteString(log_id)); | 37 CHECK(pickle->WriteString(log_id)); |
38 CHECK(pickle->WriteInt64(timestamp.ToInternalValue())); | 38 CHECK(pickle->WriteInt64(timestamp.ToInternalValue())); |
39 CHECK(pickle->WriteString(extensions)); | 39 CHECK(pickle->WriteString(extensions)); |
40 CHECK(pickle->WriteInt(signature.hash_algorithm)); | 40 CHECK(pickle->WriteInt(signature.hash_algorithm)); |
41 CHECK(pickle->WriteInt(signature.signature_algorithm)); | 41 CHECK(pickle->WriteInt(signature.signature_algorithm)); |
42 CHECK(pickle->WriteString(signature.signature_data)); | 42 CHECK(pickle->WriteString(signature.signature_data)); |
43 CHECK(pickle->WriteInt(origin)); | 43 CHECK(pickle->WriteInt(origin)); |
44 CHECK(pickle->WriteString(log_description)); | 44 CHECK(pickle->WriteString(log_description)); |
45 } | 45 } |
46 | 46 |
47 // static | 47 // static |
48 scoped_refptr<SignedCertificateTimestamp> | 48 scoped_refptr<SignedCertificateTimestamp> |
49 SignedCertificateTimestamp::CreateFromPickle(PickleIterator* iter) { | 49 SignedCertificateTimestamp::CreateFromPickle(base::PickleIterator* iter) { |
50 int version; | 50 int version; |
51 int64 timestamp; | 51 int64 timestamp; |
52 int hash_algorithm; | 52 int hash_algorithm; |
53 int sig_algorithm; | 53 int sig_algorithm; |
54 scoped_refptr<SignedCertificateTimestamp> sct( | 54 scoped_refptr<SignedCertificateTimestamp> sct( |
55 new SignedCertificateTimestamp()); | 55 new SignedCertificateTimestamp()); |
56 int origin; | 56 int origin; |
57 // string values are set directly | 57 // string values are set directly |
58 if (!(iter->ReadInt(&version) && | 58 if (!(iter->ReadInt(&version) && |
59 iter->ReadString(&sct->log_id) && | 59 iter->ReadString(&sct->log_id) && |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 bool DigitallySigned::SignatureParametersMatch( | 94 bool DigitallySigned::SignatureParametersMatch( |
95 HashAlgorithm other_hash_algorithm, | 95 HashAlgorithm other_hash_algorithm, |
96 SignatureAlgorithm other_signature_algorithm) const { | 96 SignatureAlgorithm other_signature_algorithm) const { |
97 return (hash_algorithm == other_hash_algorithm) && | 97 return (hash_algorithm == other_hash_algorithm) && |
98 (signature_algorithm == other_signature_algorithm); | 98 (signature_algorithm == other_signature_algorithm); |
99 } | 99 } |
100 } // namespace ct | 100 } // namespace ct |
101 | 101 |
102 } // namespace net | 102 } // namespace net |
OLD | NEW |