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

Unified Diff: net/der/parser.h

Issue 1541213002: Adding OCSP Parser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix more null checks. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/data/parse_ocsp_unittest/unknown_response.pem ('k') | net/der/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/der/parser.h
diff --git a/net/der/parser.h b/net/der/parser.h
index 2192371d6c62890aea9426acb052d61071100033..d18728e1858acfbb1af093a116dd8d401f6a45f6 100644
--- a/net/der/parser.h
+++ b/net/der/parser.h
@@ -19,6 +19,7 @@ namespace net {
namespace der {
class BitString;
+struct GeneralizedTime;
// Parses a DER-encoded ASN.1 structure. DER (distinguished encoding rules)
// encodes each data value with a tag, length, and value (TLV). The tag
@@ -146,10 +147,19 @@ class NET_EXPORT Parser {
// to be 0x30 (SEQUENCE).
bool ReadSequence(Parser* out) WARN_UNUSED_RESULT;
+ // Expects the current tag to be kInteger, and calls ParseUint8 on the
+ // current value. Note that DER-encoded integers are arbitrary precision,
+ // so this method will fail for valid input that represents an integer
+ // outside the range of an uint8_t.
+ //
+ // Note that on failure the Parser is left in an undefined state (the
+ // input may or may not have been advanced).
+ bool ReadUint8(uint8_t* out) WARN_UNUSED_RESULT;
+
// Expects the current tag to be kInteger, and calls ParseUint64 on the
// current value. Note that DER-encoded integers are arbitrary precision,
// so this method will fail for valid input that represents an integer
- // outside the range of an int64_t.
+ // outside the range of an uint64_t.
//
// Note that on failure the Parser is left in an undefined state (the
// input may or may not have been advanced).
@@ -161,6 +171,12 @@ class NET_EXPORT Parser {
// input may or may not have been advanced).
bool ReadBitString(BitString* out) WARN_UNUSED_RESULT;
+ // Reads a GeneralizeTime. On success fills |out| and returns true.
+ //
+ // Note that on failure the Parser is left in an undefined state (the
+ // input may or may not have been advanced).
+ bool ReadGeneralizedTime(GeneralizedTime* out) WARN_UNUSED_RESULT;
+
// Lower level methods. The previous methods couple reading data from the
// input with advancing the Parser's internal pointer to the next TLV; these
// lower level methods decouple those two steps into methods that read from
« no previous file with comments | « net/data/parse_ocsp_unittest/unknown_response.pem ('k') | net/der/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698