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

Side by Side Diff: net/base/x509_certificate.cc

Issue 11458012: SSLCertRequestInfo: Add |valid_cas| and |valid_key_types| (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/base64.h" 14 #include "base/base64.h"
15 #include "base/lazy_instance.h" 15 #include "base/lazy_instance.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/memory/singleton.h" 17 #include "base/memory/singleton.h"
18 #include "base/metrics/histogram.h" 18 #include "base/metrics/histogram.h"
19 #include "base/pickle.h" 19 #include "base/pickle.h"
20 #include "base/sha1.h" 20 #include "base/sha1.h"
21 #include "base/string_piece.h" 21 #include "base/string_piece.h"
22 #include "base/string_util.h" 22 #include "base/string_util.h"
23 #include "base/synchronization/lock.h" 23 #include "base/synchronization/lock.h"
24 #include "base/time.h" 24 #include "base/time.h"
25 #include "googleurl/src/url_canon_ip.h" 25 #include "googleurl/src/url_canon_ip.h"
26 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
27 #include "net/base/pem_tokenizer.h" 27 #include "net/base/pem_tokenizer.h"
28 #include "net/base/ssl_cert_request_info.h"
29 #include "net/base/x509_cert_types.h"
28 30
29 namespace net { 31 namespace net {
30 32
31 namespace { 33 namespace {
32 34
33 // Indicates the order to use when trying to decode binary data, which is 35 // Indicates the order to use when trying to decode binary data, which is
34 // based on (speculation) as to what will be most common -> least common 36 // based on (speculation) as to what will be most common -> least common
35 const X509Certificate::Format kFormatDecodePriority[] = { 37 const X509Certificate::Format kFormatDecodePriority[] = {
36 X509Certificate::FORMAT_SINGLE_CERTIFICATE, 38 X509Certificate::FORMAT_SINGLE_CERTIFICATE,
37 X509Certificate::FORMAT_PKCS7 39 X509Certificate::FORMAT_PKCS7
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 if (cert_handle_) { 693 if (cert_handle_) {
692 RemoveFromCache(cert_handle_); 694 RemoveFromCache(cert_handle_);
693 FreeOSCertHandle(cert_handle_); 695 FreeOSCertHandle(cert_handle_);
694 } 696 }
695 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { 697 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) {
696 RemoveFromCache(intermediate_ca_certs_[i]); 698 RemoveFromCache(intermediate_ca_certs_[i]);
697 FreeOSCertHandle(intermediate_ca_certs_[i]); 699 FreeOSCertHandle(intermediate_ca_certs_[i]);
698 } 700 }
699 } 701 }
700 702
703 #if !defined(USE_OPENSSL)
704 bool X509Certificate::IsValidClientCertificate(
705 const SSLCertRequestInfo& cert_info) {
706 DCHECK(cert_info.no_client_certs == false);
Ryan Sleevi 2012/12/11 21:30:24 While this impl is NACKed, as a style nit, this DC
digit1 2012/12/11 23:05:31 Oh thanks, point taken, will do.
707
708 // Check that the current certificate matches the critera supplied in
709 // a CertificateRequest message.
710 const std::vector<scoped_refptr<X509Certificate> >& client_certs =
711 cert_info.client_certs;
712 for (size_t i = 0; i < client_certs.size(); ++i) {
713 if (Equals(client_certs[i])) {
714 return true;
715 }
716 }
717 return false;
718 #endif // !USE_OPENSSL
719
701 } // namespace net 720 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698