Index: net/cert/internal/parse_certificate.cc |
diff --git a/net/cert/internal/parse_certificate.cc b/net/cert/internal/parse_certificate.cc |
index 6cfc4b5afeb51a12ea96db689d9c4af7f6b121b5..78baaac89424c9fef2238e2052bd3a6811f199b5 100644 |
--- a/net/cert/internal/parse_certificate.cc |
+++ b/net/cert/internal/parse_certificate.cc |
@@ -551,6 +551,16 @@ der::Input AdOcspOid() { |
return der::Input(oid); |
} |
+der::Input InhibitAnyPolicyOid() { |
+ // From RFC 5280: |
+ // |
+ // id-ce-inhibitAnyPolicy OBJECT IDENTIFIER ::= { id-ce 54 } |
+ // |
+ // In dotted notation: 2.5.29.54 |
+ static const uint8_t oid[] = {0x55, 0x1d, 0x36}; |
+ return der::Input(oid); |
+} |
+ |
NET_EXPORT bool ParseExtensions( |
const der::Input& extensions_tlv, |
std::map<der::Input, ParsedExtension>* extensions) { |
@@ -794,4 +804,24 @@ bool ParsePolicyConstraints(const der::Input& policy_constraints_tlv, |
return true; |
} |
+// From RFC 5280: |
+// |
+// InhibitAnyPolicy ::= SkipCerts |
+// |
+// SkipCerts ::= INTEGER (0..MAX) |
+bool ParseInhibitAnyPolicy(const der::Input& inhibit_any_policy_tlv, |
+ uint8_t* out) { |
+ der::Parser parser(inhibit_any_policy_tlv); |
+ |
+ // TODO(eroman): Surface reason for failure if length was longer than uint8. |
+ if (!parser.ReadUint8(out)) |
+ return false; |
+ |
+ // There should be no remaining data. |
+ if (parser.HasMore()) |
+ return false; |
+ |
+ return true; |
+} |
+ |
} // namespace net |