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

Unified Diff: net/base/x509_certificate.cc

Issue 8568040: Refuse to accept certificate chains containing any RSA public key smaller (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
Index: net/base/x509_certificate.cc
===================================================================
--- net/base/x509_certificate.cc (revision 110129)
+++ net/base/x509_certificate.cc (working copy)
@@ -590,6 +590,30 @@
int rv = VerifyInternal(hostname, flags, crl_set, verify_result);
+ // Check for weak keys in the entire verified chain.
+ size_t size_bits = 0;
+ PublicKeyType type = kPublicKeyTypeUnknown;
+ bool weak_key = false;
+
+ GetPublicKeyInfo(verify_result->verified_cert->os_cert_handle(), &size_bits,
+ &type);
+ if (type == kPublicKeyTypeRSA && size_bits < 1024)
+ weak_key = true;
wtc 2011/11/17 02:52:18 It seems that a IsWeakPublicKey/ContainsWeakPublic
+
+ const OSCertHandles& intermediates =
+ verify_result->verified_cert->GetIntermediateCertificates();
+ for (OSCertHandles::const_iterator i = intermediates.begin();
+ i != intermediates.end(); ++i) {
+ GetPublicKeyInfo(*i, &size_bits, &type);
+ if (type == kPublicKeyTypeRSA && size_bits < 1024)
+ weak_key = true;
+ }
+
+ if (weak_key) {
+ verify_result->cert_status |= CERT_STATUS_WEAK_KEY;
+ return MapCertStatusToNetError(verify_result->cert_status);
+ }
+
// This check is done after VerifyInternal so that VerifyInternal can fill in
// the list of public key hashes.
if (IsPublicKeyBlacklisted(verify_result->public_key_hashes)) {

Powered by Google App Engine
This is Rietveld 408576698