OLD | NEW |
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/socket/ssl_server_socket_nss.h" | 5 #include "net/socket/ssl_server_socket_nss.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <winsock2.h> | 8 #include <winsock2.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 } | 350 } |
351 | 351 |
352 rv = SSL_HandshakeCallback(nss_fd_, HandshakeCallback, this); | 352 rv = SSL_HandshakeCallback(nss_fd_, HandshakeCallback, this); |
353 if (rv != SECSuccess) { | 353 if (rv != SECSuccess) { |
354 LogFailedNSSFunction(net_log_, "SSL_HandshakeCallback", ""); | 354 LogFailedNSSFunction(net_log_, "SSL_HandshakeCallback", ""); |
355 return ERR_UNEXPECTED; | 355 return ERR_UNEXPECTED; |
356 } | 356 } |
357 | 357 |
358 // Get a certificate of CERTCertificate structure. | 358 // Get a certificate of CERTCertificate structure. |
359 std::string der_string; | 359 std::string der_string; |
360 if (!cert_->GetDEREncoded(&der_string)) | 360 if (!X509Certificate::GetDEREncoded(cert_->os_cert_handle(), &der_string)) |
361 return ERR_UNEXPECTED; | 361 return ERR_UNEXPECTED; |
362 | 362 |
363 SECItem der_cert; | 363 SECItem der_cert; |
364 der_cert.data = reinterpret_cast<unsigned char*>(const_cast<char*>( | 364 der_cert.data = reinterpret_cast<unsigned char*>(const_cast<char*>( |
365 der_string.data())); | 365 der_string.data())); |
366 der_cert.len = der_string.length(); | 366 der_cert.len = der_string.length(); |
367 der_cert.type = siDERCertBuffer; | 367 der_cert.type = siDERCertBuffer; |
368 | 368 |
369 // Parse into a CERTCertificate structure. | 369 // Parse into a CERTCertificate structure. |
370 CERTCertificate* cert = CERT_NewTempCertificate( | 370 CERTCertificate* cert = CERT_NewTempCertificate( |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 // Initialize the NSS SSL library in a threadsafe way. This also | 764 // Initialize the NSS SSL library in a threadsafe way. This also |
765 // initializes the NSS base library. | 765 // initializes the NSS base library. |
766 EnsureNSSSSLInit(); | 766 EnsureNSSSSLInit(); |
767 if (!NSS_IsInitialized()) | 767 if (!NSS_IsInitialized()) |
768 return ERR_UNEXPECTED; | 768 return ERR_UNEXPECTED; |
769 | 769 |
770 return OK; | 770 return OK; |
771 } | 771 } |
772 | 772 |
773 } // namespace net | 773 } // namespace net |
OLD | NEW |