| OLD | NEW |
| 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/cert/x509_certificate.h" | 5 #include "net/cert/x509_certificate.h" |
| 6 | 6 |
| 7 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. | 7 #include <blapi.h> // Implement CalculateChainFingerprint() with NSS. |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 if (!cert_handle_) | 176 if (!cert_handle_) |
| 177 return; | 177 return; |
| 178 | 178 |
| 179 scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter> alt_name_info; | 179 scoped_ptr<CERT_ALT_NAME_INFO, base::FreeDeleter> alt_name_info; |
| 180 GetCertSubjectAltName(cert_handle_, &alt_name_info); | 180 GetCertSubjectAltName(cert_handle_, &alt_name_info); |
| 181 CERT_ALT_NAME_INFO* alt_name = alt_name_info.get(); | 181 CERT_ALT_NAME_INFO* alt_name = alt_name_info.get(); |
| 182 if (alt_name) { | 182 if (alt_name) { |
| 183 int num_entries = alt_name->cAltEntry; | 183 int num_entries = alt_name->cAltEntry; |
| 184 for (int i = 0; i < num_entries; i++) { | 184 for (int i = 0; i < num_entries; i++) { |
| 185 // dNSName is an ASN.1 IA5String representing a string of ASCII | 185 // dNSName is an ASN.1 IA5String representing a string of ASCII |
| 186 // characters, so we can use WideToASCII here. | 186 // characters, so we can use UTF16ToASCII here. |
| 187 const CERT_ALT_NAME_ENTRY& entry = alt_name->rgAltEntry[i]; | 187 const CERT_ALT_NAME_ENTRY& entry = alt_name->rgAltEntry[i]; |
| 188 | 188 |
| 189 if (dns_names && entry.dwAltNameChoice == CERT_ALT_NAME_DNS_NAME) { | 189 if (dns_names && entry.dwAltNameChoice == CERT_ALT_NAME_DNS_NAME) { |
| 190 dns_names->push_back(WideToASCII(entry.pwszDNSName)); | 190 dns_names->push_back(base::UTF16ToASCII(entry.pwszDNSName)); |
| 191 } else if (ip_addrs && | 191 } else if (ip_addrs && |
| 192 entry.dwAltNameChoice == CERT_ALT_NAME_IP_ADDRESS) { | 192 entry.dwAltNameChoice == CERT_ALT_NAME_IP_ADDRESS) { |
| 193 ip_addrs->push_back(std::string( | 193 ip_addrs->push_back(std::string( |
| 194 reinterpret_cast<const char*>(entry.IPAddress.pbData), | 194 reinterpret_cast<const char*>(entry.IPAddress.pbData), |
| 195 entry.IPAddress.cbData)); | 195 entry.IPAddress.cbData)); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 } | 199 } |
| 200 | 200 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 if (IsCertNameBlobInIssuerList(&(*it)->pCertInfo->Issuer, | 445 if (IsCertNameBlobInIssuerList(&(*it)->pCertInfo->Issuer, |
| 446 valid_issuers)) { | 446 valid_issuers)) { |
| 447 return true; | 447 return true; |
| 448 } | 448 } |
| 449 } | 449 } |
| 450 | 450 |
| 451 return false; | 451 return false; |
| 452 } | 452 } |
| 453 | 453 |
| 454 } // namespace net | 454 } // namespace net |
| OLD | NEW |