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

Side by Side Diff: net/base/x509_certificate_openssl.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/x509_certificate.h" 5 #include "net/base/x509_certificate.h"
6 6
7 #include <openssl/asn1.h> 7 #include <openssl/asn1.h>
8 #include <openssl/crypto.h> 8 #include <openssl/crypto.h>
9 #include <openssl/obj_mac.h> 9 #include <openssl/obj_mac.h>
10 #include <openssl/pem.h> 10 #include <openssl/pem.h>
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 Pickle* pickle) { 612 Pickle* pickle) {
613 DERCache der_cache; 613 DERCache der_cache;
614 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache)) 614 if (!GetDERAndCacheIfNeeded(cert_handle, &der_cache))
615 return false; 615 return false;
616 616
617 return pickle->WriteData( 617 return pickle->WriteData(
618 reinterpret_cast<const char*>(der_cache.data), 618 reinterpret_cast<const char*>(der_cache.data),
619 der_cache.data_length); 619 der_cache.data_length);
620 } 620 }
621 621
622 //static
agl 2011/11/16 15:57:55 space before "static"
623 void X509Certificate::GetPublicKeyInfo(OSCertHandle cert_handle,
624 size_t* size_bits,
625 PublicKeyType* type) {
626 EVP_PKEY* key = X509_get_pubkey(cert_handle);
627 *size_bits = EVP_PKEY_size(key) * 8;
628
629 switch (key->type) {
630 case EVP_PKEY_RSA:
631 *type = PublicKeyType::RSA;
632 break;
633 case EVP_PKEY_DSA:
634 *type = PublicKeyType::DSA;
635 break;
636 case EVP_PKEY_EC:
637 *type = PublicKeyType::EC;
638 break;
639 case EVP_PKEY_DH:
640 *type = PublicKeyType::DH;
641 break;
642 default:
643 *type = PublicKeyType::NONE;
644 }
645 }
646
622 } // namespace net 647 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698