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

Side by Side Diff: net/der/parse_values.h

Issue 2075783002: Adding additional comparison operators for GeneralizedTime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittest. Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/der/parse_values.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 uint16_t year; 91 uint16_t year;
92 uint8_t month; 92 uint8_t month;
93 uint8_t day; 93 uint8_t day;
94 uint8_t hours; 94 uint8_t hours;
95 uint8_t minutes; 95 uint8_t minutes;
96 uint8_t seconds; 96 uint8_t seconds;
97 }; 97 };
98 98
99 NET_EXPORT_PRIVATE bool operator<(const GeneralizedTime& lhs, 99 NET_EXPORT_PRIVATE bool operator<(const GeneralizedTime& lhs,
100 const GeneralizedTime& rhs); 100 const GeneralizedTime& rhs);
101 NET_EXPORT_PRIVATE bool operator<=(const GeneralizedTime& lhs,
102 const GeneralizedTime& rhs);
103 NET_EXPORT_PRIVATE bool operator>(const GeneralizedTime& lhs,
104 const GeneralizedTime& rhs);
105 NET_EXPORT_PRIVATE bool operator>=(const GeneralizedTime& lhs,
106 const GeneralizedTime& rhs);
101 107
102 // Reads a DER-encoded ASN.1 UTCTime value from |in| and puts the resulting 108 // Reads a DER-encoded ASN.1 UTCTime value from |in| and puts the resulting
103 // value in |out|, returning true if the UTCTime could be parsed successfully. 109 // value in |out|, returning true if the UTCTime could be parsed successfully.
104 NET_EXPORT bool ParseUTCTime(const Input& in, 110 NET_EXPORT bool ParseUTCTime(const Input& in,
105 GeneralizedTime* out) WARN_UNUSED_RESULT; 111 GeneralizedTime* out) WARN_UNUSED_RESULT;
106 112
107 // Like ParseUTCTime, but it is more lenient in what is accepted. DER requires 113 // Like ParseUTCTime, but it is more lenient in what is accepted. DER requires
108 // a UTCTime to be in the format YYMMDDhhmmssZ; this function will accept both 114 // a UTCTime to be in the format YYMMDDhhmmssZ; this function will accept both
109 // that and YYMMDDhhmmZ, which is a valid BER encoding of a UTCTime which 115 // that and YYMMDDhhmmZ, which is a valid BER encoding of a UTCTime which
110 // sometimes incorrectly appears in X.509 certificates. 116 // sometimes incorrectly appears in X.509 certificates.
111 NET_EXPORT bool ParseUTCTimeRelaxed(const Input& in, 117 NET_EXPORT bool ParseUTCTimeRelaxed(const Input& in,
112 GeneralizedTime* out) WARN_UNUSED_RESULT; 118 GeneralizedTime* out) WARN_UNUSED_RESULT;
113 119
114 // Reads a DER-encoded ASN.1 GeneralizedTime value from |in| and puts the 120 // Reads a DER-encoded ASN.1 GeneralizedTime value from |in| and puts the
115 // resulting value in |out|, returning true if the GeneralizedTime could 121 // resulting value in |out|, returning true if the GeneralizedTime could
116 // be parsed successfully. This function is even more restrictive than the 122 // be parsed successfully. This function is even more restrictive than the
117 // DER rules - it follows the rules from RFC5280, which does not allow for 123 // DER rules - it follows the rules from RFC5280, which does not allow for
118 // fractional seconds. 124 // fractional seconds.
119 NET_EXPORT bool ParseGeneralizedTime(const Input& in, 125 NET_EXPORT bool ParseGeneralizedTime(const Input& in,
120 GeneralizedTime* out) WARN_UNUSED_RESULT; 126 GeneralizedTime* out) WARN_UNUSED_RESULT;
121 127
122 } // namespace der 128 } // namespace der
123 129
124 } // namespace net 130 } // namespace net
125 131
126 #endif // NET_DER_PARSE_VALUES_H_ 132 #endif // NET_DER_PARSE_VALUES_H_
OLDNEW
« no previous file with comments | « no previous file | net/der/parse_values.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698