Chromium Code Reviews| Index: net/base/x509_cert_types.h |
| diff --git a/net/base/x509_cert_types.h b/net/base/x509_cert_types.h |
| index 7723c22aa0c1e44a48f3fbb587ed980072248f8d..fae80ae9a6304c282e4937077cf773595338d1c8 100644 |
| --- a/net/base/x509_cert_types.h |
| +++ b/net/base/x509_cert_types.h |
| @@ -29,6 +29,11 @@ |
| struct CERTCertificateStr; |
| #endif |
| +namespace base { |
| +class Time; |
| +class StringPiece; |
| +} // namespace base |
| + |
| namespace net { |
| class X509Certificate; |
| @@ -139,6 +144,23 @@ inline bool CSSMOIDEqual(const CSSM_OID* oid1, const CSSM_OID* oid2) { |
| } |
| #endif |
| +// A list of ASN.1 date/time formats that ParseCertificateDate() supports, |
| +// encoded in the canonical forms specified in RFC 2459/3280/5280. |
| +enum CertificateDateFormat { |
|
wtc
2010/11/11 01:33:52
Nit: probably should rename this enum CertDataForm
|
| + // UTCTime: Format is YYMMDDHHMMSSZ |
| + CERT_DATE_FORMAT_UTC_TIME, |
| + |
| + // GeneralizedTime: Format is YYYYMMDDHHMMSSZ |
| + CERT_DATE_FORMAT_GENERALIZED_TIME, |
| +}; |
| + |
| +// Attempts to parse |raw_date|, an ASN.1 date/time string encoded as |
| +// |format|, and writes the result into |*time|. If an invalid date is |
| +// specified, or if parsing fails, returns false, and |*time| will not be |
| +// updated. |
| +bool ParseCertificateDate(const base::StringPiece& raw_date, |
| + CertificateDateFormat format, |
| + base::Time* time); |
| } // namespace net |
| #endif // NET_BASE_X509_CERT_TYPES_H_ |