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

Unified Diff: net/cert/internal/certificate_policies.cc

Issue 2870323002: Add parsing for RFC 5280's InhibitAnyPolicy. (Closed)
Patch Set: rebase Created 3 years, 7 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/cert/internal/certificate_policies.h ('k') | net/cert/internal/certificate_policies_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/certificate_policies.cc
diff --git a/net/cert/internal/certificate_policies.cc b/net/cert/internal/certificate_policies.cc
index d36cebfde808daf9cd12bcb61f563347ecbd96d1..c46f064901c2e705ff69703f1e3587ab57824174 100644
--- a/net/cert/internal/certificate_policies.cc
+++ b/net/cert/internal/certificate_policies.cc
@@ -86,6 +86,16 @@ const der::Input AnyPolicy() {
return der::Input(any_policy);
}
+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);
+}
+
// RFC 5280 section 4.2.1.4. Certificate Policies:
//
// certificatePolicies ::= SEQUENCE SIZE (1..MAX) OF PolicyInformation
@@ -239,4 +249,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* num_certs) {
+ der::Parser parser(inhibit_any_policy_tlv);
+
+ // TODO(eroman): Surface reason for failure if length was longer than uint8.
+ if (!parser.ReadUint8(num_certs))
+ return false;
+
+ // There should be no remaining data.
+ if (parser.HasMore())
+ return false;
+
+ return true;
+}
+
} // namespace net
« no previous file with comments | « net/cert/internal/certificate_policies.h ('k') | net/cert/internal/certificate_policies_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698