OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_DER_PARSE_VALUES_H_ | 5 #ifndef NET_DER_PARSE_VALUES_H_ |
6 #define NET_DER_PARSE_VALUES_H_ | 6 #define NET_DER_PARSE_VALUES_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/time/time.h" |
11 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
12 #include "net/der/input.h" | 13 #include "net/der/input.h" |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 | 16 |
16 namespace der { | 17 namespace der { |
17 | 18 |
18 // Reads a DER-encoded ASN.1 BOOLEAN value from |in| and puts the resulting | 19 // Reads a DER-encoded ASN.1 BOOLEAN value from |in| and puts the resulting |
19 // value in |out|. Returns whether the encoded value could successfully be | 20 // value in |out|. Returns whether the encoded value could successfully be |
20 // read. | 21 // read. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 GeneralizedTime* out) WARN_UNUSED_RESULT; | 119 GeneralizedTime* out) WARN_UNUSED_RESULT; |
119 | 120 |
120 // Reads a DER-encoded ASN.1 GeneralizedTime value from |in| and puts the | 121 // Reads a DER-encoded ASN.1 GeneralizedTime value from |in| and puts the |
121 // resulting value in |out|, returning true if the GeneralizedTime could | 122 // resulting value in |out|, returning true if the GeneralizedTime could |
122 // be parsed successfully. This function is even more restrictive than the | 123 // be parsed successfully. This function is even more restrictive than the |
123 // DER rules - it follows the rules from RFC5280, which does not allow for | 124 // DER rules - it follows the rules from RFC5280, which does not allow for |
124 // fractional seconds. | 125 // fractional seconds. |
125 NET_EXPORT bool ParseGeneralizedTime(const Input& in, | 126 NET_EXPORT bool ParseGeneralizedTime(const Input& in, |
126 GeneralizedTime* out) WARN_UNUSED_RESULT; | 127 GeneralizedTime* out) WARN_UNUSED_RESULT; |
127 | 128 |
| 129 // Converts an exploded time to a GeneralizedTime. |
| 130 NET_EXPORT der::GeneralizedTime ConvertBaseTime( |
| 131 const base::Time::Exploded& exploded); |
| 132 |
| 133 // Converts a base::Time assuming the time is in UTC. |
| 134 NET_EXPORT der::GeneralizedTime ConvertBaseUTCTime(const base::Time& time); |
| 135 |
128 } // namespace der | 136 } // namespace der |
129 | 137 |
130 } // namespace net | 138 } // namespace net |
131 | 139 |
132 #endif // NET_DER_PARSE_VALUES_H_ | 140 #endif // NET_DER_PARSE_VALUES_H_ |
OLD | NEW |