| 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 #ifndef NET_CERT_CT_SERIALIZATION_H_ | 5 #ifndef NET_CERT_CT_SERIALIZATION_H_ |
| 6 #define NET_CERT_CT_SERIALIZATION_H_ | 6 #define NET_CERT_CT_SERIALIZATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" |
| 11 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 13 #include "base/time/time.h" |
| 12 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
| 13 #include "net/cert/signed_certificate_timestamp.h" | |
| 14 #include "net/cert/signed_tree_head.h" | |
| 15 | 15 |
| 16 namespace net { | 16 namespace net { |
| 17 | 17 |
| 18 // Utility functions for encoding/decoding structures used by Certificate | 18 // Utility functions for encoding/decoding structures used by Certificate |
| 19 // Transparency to/from the TLS wire format encoding. | 19 // Transparency to/from the TLS wire format encoding. |
| 20 namespace ct { | 20 namespace ct { |
| 21 | 21 |
| 22 struct DigitallySigned; |
| 23 struct LogEntry; |
| 24 struct SignedCertificateTimestamp; |
| 25 struct SignedTreeHead; |
| 26 |
| 22 // If |input.signature_data| is less than kMaxSignatureLength, encodes the | 27 // If |input.signature_data| is less than kMaxSignatureLength, encodes the |
| 23 // |input| to |output| and returns true. Otherwise, returns false. | 28 // |input| to |output| and returns true. Otherwise, returns false. |
| 24 NET_EXPORT_PRIVATE bool EncodeDigitallySigned(const DigitallySigned& input, | 29 NET_EXPORT_PRIVATE bool EncodeDigitallySigned(const DigitallySigned& input, |
| 25 std::string* output); | 30 std::string* output); |
| 26 | 31 |
| 27 // Reads and decodes a DigitallySigned object from |input|. | 32 // Reads and decodes a DigitallySigned object from |input|. |
| 28 // The bytes read from |input| are discarded (i.e. |input|'s prefix removed) | 33 // The bytes read from |input| are discarded (i.e. |input|'s prefix removed) |
| 29 // Returns true and fills |output| if all fields can be read, false otherwise. | 34 // Returns true and fills |output| if all fields can be read, false otherwise. |
| 30 NET_EXPORT_PRIVATE bool DecodeDigitallySigned(base::StringPiece* input, | 35 NET_EXPORT_PRIVATE bool DecodeDigitallySigned(base::StringPiece* input, |
| 31 DigitallySigned* output); | 36 DigitallySigned* output); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 scoped_refptr<ct::SignedCertificateTimestamp>* output); | 79 scoped_refptr<ct::SignedCertificateTimestamp>* output); |
| 75 | 80 |
| 76 // Writes an SCTList into |output|, containing a single |sct|. | 81 // Writes an SCTList into |output|, containing a single |sct|. |
| 77 NET_EXPORT_PRIVATE bool EncodeSCTListForTesting(const base::StringPiece& sct, | 82 NET_EXPORT_PRIVATE bool EncodeSCTListForTesting(const base::StringPiece& sct, |
| 78 std::string* output); | 83 std::string* output); |
| 79 } // namespace ct | 84 } // namespace ct |
| 80 | 85 |
| 81 } // namespace net | 86 } // namespace net |
| 82 | 87 |
| 83 #endif // NET_CERT_CT_SERIALIZATION_H_ | 88 #endif // NET_CERT_CT_SERIALIZATION_H_ |
| OLD | NEW |