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

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

Issue 2803513003: Remove ParsedCertificate::unparsed_extensions(). (Closed)
Patch Set: remove unused Created 3 years, 8 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/parsed_certificate_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/verify_certificate_chain.cc
diff --git a/net/cert/internal/verify_certificate_chain.cc b/net/cert/internal/verify_certificate_chain.cc
index 34d1422385fc340aa43c43aee052fb4e821421ce..cc9da69f6d836d9533212c8b9e0b6958ea131105 100644
--- a/net/cert/internal/verify_certificate_chain.cc
+++ b/net/cert/internal/verify_certificate_chain.cc
@@ -56,15 +56,32 @@ DEFINE_CERT_ERROR_ID(kSignatureAlgorithmsDifferentEncoding,
"Certificate.signatureAlgorithm is encoded differently "
"than TBSCertificate.signature");
+bool IsHandledCriticalExtensionOid(const der::Input& oid) {
+ if (oid == BasicConstraintsOid())
+ return true;
+ if (oid == KeyUsageOid())
+ return true;
+ if (oid == NameConstraintsOid())
+ return true;
+ // TODO(eroman): SubjectAltName isn't actually used here, but rather is being
+ // checked by a higher layer.
+ if (oid == SubjectAltNameOid())
+ return true;
+
+ // TODO(eroman): Make this more complete.
+ return false;
+}
+
// Adds errors to |errors| if the certificate contains unconsumed _critical_
// extensions.
void VerifyNoUnconsumedCriticalExtensions(const ParsedCertificate& cert,
CertErrors* errors) {
- for (const auto& entry : cert.unparsed_extensions()) {
- if (entry.second.critical) {
+ for (const auto& it : cert.extensions()) {
+ const ParsedExtension& extension = it.second;
+ if (extension.critical && !IsHandledCriticalExtensionOid(extension.oid)) {
errors->AddError(kUnconsumedCriticalExtension,
- CreateCertErrorParams2Der("oid", entry.second.oid,
- "value", entry.second.value));
+ CreateCertErrorParams2Der("oid", extension.oid, "value",
+ extension.value));
}
}
}
« no previous file with comments | « net/cert/internal/parsed_certificate_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698