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

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

Issue 5746003: Defines SSLServerSocket and implements SSLServerSocketNSS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: convert cert and key Created 10 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 | Annotate | Revision Log
« no previous file with comments | « net/base/x509_certificate_unittest.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/crypto/scoped_capi_types.h" 7 #include "base/crypto/scoped_capi_types.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 verify_result->cert_status &= ~CERT_STATUS_NO_REVOCATION_MECHANISM; 771 verify_result->cert_status &= ~CERT_STATUS_NO_REVOCATION_MECHANISM;
772 772
773 if (IsCertStatusError(verify_result->cert_status)) 773 if (IsCertStatusError(verify_result->cert_status))
774 return MapCertStatusToNetError(verify_result->cert_status); 774 return MapCertStatusToNetError(verify_result->cert_status);
775 775
776 if (ev_policy_oid && CheckEV(chain_context, ev_policy_oid)) 776 if (ev_policy_oid && CheckEV(chain_context, ev_policy_oid))
777 verify_result->cert_status |= CERT_STATUS_IS_EV; 777 verify_result->cert_status |= CERT_STATUS_IS_EV;
778 return OK; 778 return OK;
779 } 779 }
780 780
781 bool X509Certificate::GetDEREncoded(std::string* encoded) {
782 if (!cert_handle_->pbCertEncoded || !cert_handle_->cbCertEncoded)
783 return false;
784 encoded->clear();
785 encoded->append(reinterpret_cast<char*>(cert_handle_->pbCertEncoded),
786 cert_handle_->cbCertEncoded);
787 return true;
788 }
789
781 // Returns true if the certificate is an extended-validation certificate. 790 // Returns true if the certificate is an extended-validation certificate.
782 // 791 //
783 // This function checks the certificatePolicies extensions of the 792 // This function checks the certificatePolicies extensions of the
784 // certificates in the certificate chain according to Section 7 (pp. 11-12) 793 // certificates in the certificate chain according to Section 7 (pp. 11-12)
785 // of the EV Certificate Guidelines Version 1.0 at 794 // of the EV Certificate Guidelines Version 1.0 at
786 // http://cabforum.org/EV_Certificate_Guidelines.pdf. 795 // http://cabforum.org/EV_Certificate_Guidelines.pdf.
787 bool X509Certificate::CheckEV(PCCERT_CHAIN_CONTEXT chain_context, 796 bool X509Certificate::CheckEV(PCCERT_CHAIN_CONTEXT chain_context,
788 const char* policy_oid) const { 797 const char* policy_oid) const {
789 DCHECK(chain_context->cChain != 0); 798 DCHECK(chain_context->cChain != 0);
790 // If the cert doesn't match any of the policies, the 799 // If the cert doesn't match any of the policies, the
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 DWORD sha1_size = sizeof(sha1.data); 896 DWORD sha1_size = sizeof(sha1.data);
888 rv = CryptHashCertificate(NULL, CALG_SHA1, 0, cert->pbCertEncoded, 897 rv = CryptHashCertificate(NULL, CALG_SHA1, 0, cert->pbCertEncoded,
889 cert->cbCertEncoded, sha1.data, &sha1_size); 898 cert->cbCertEncoded, sha1.data, &sha1_size);
890 DCHECK(rv && sha1_size == sizeof(sha1.data)); 899 DCHECK(rv && sha1_size == sizeof(sha1.data));
891 if (!rv) 900 if (!rv)
892 memset(sha1.data, 0, sizeof(sha1.data)); 901 memset(sha1.data, 0, sizeof(sha1.data));
893 return sha1; 902 return sha1;
894 } 903 }
895 904
896 } // namespace net 905 } // namespace net
OLDNEW
« no previous file with comments | « net/base/x509_certificate_unittest.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698