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

Unified Diff: net/cert/internal/parse_certificate.h

Issue 1690123002: Reduce Certificate Parsing Strictness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing 21 octet weakness. Created 4 years, 10 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 | « no previous file | net/cert/internal/parse_certificate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/internal/parse_certificate.h
diff --git a/net/cert/internal/parse_certificate.h b/net/cert/internal/parse_certificate.h
index e7a1670af1b5bb9f6452ecedf5d454bf8df01d2b..eca692dd044ad3de7adc654956ed0d9edd3179b4 100644
--- a/net/cert/internal/parse_certificate.h
+++ b/net/cert/internal/parse_certificate.h
@@ -19,6 +19,33 @@ namespace net {
struct ParsedCertificate;
struct ParsedTbsCertificate;
+// Returns true if the given serial number (CertificateSerialNumber in RFC 5280)
+// is valid:
+//
+// CertificateSerialNumber ::= INTEGER
+//
+// The input to this function is the (unverified) value octets of the INTEGER.
+// This function will verify that:
+//
+// * The octets are a valid DER-encoding of an INTEGER (for instance, minimal
+// encoding length).
+//
+// * No more than 20 octets are used.
+//
+// Note that it DOES NOT reject non-positive values (zero or negative).
+//
+// For reference, here is what RFC 5280 section 4.1.2.2 says:
+//
+// Given the uniqueness requirements above, serial numbers can be
+// expected to contain long integers. Certificate users MUST be able to
+// handle serialNumber values up to 20 octets. Conforming CAs MUST NOT
+// use serialNumber values longer than 20 octets.
+//
+// Note: Non-conforming CAs may issue certificates with serial numbers
+// that are negative or zero. Certificate users SHOULD be prepared to
+// gracefully handle such certificates.
+bool VerifySerialNumber(const der::Input& value) WARN_UNUSED_RESULT;
+
// Parses a DER-encoded "Certificate" as specified by RFC 5280. Returns true on
// success and sets the results in |out|.
//
« no previous file with comments | « no previous file | net/cert/internal/parse_certificate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698