| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 CERT_GetDefaultCertDB(), &der_cert, NULL, PR_FALSE, PR_TRUE); | 295 CERT_GetDefaultCertDB(), &der_cert, NULL, PR_FALSE, PR_TRUE); |
| 296 | 296 |
| 297 // Get a key of SECKEYPrivateKey* structure. | 297 // Get a key of SECKEYPrivateKey* structure. |
| 298 std::vector<uint8> key_vector; | 298 std::vector<uint8> key_vector; |
| 299 if (!key_->ExportPrivateKey(&key_vector)) { | 299 if (!key_->ExportPrivateKey(&key_vector)) { |
| 300 CERT_DestroyCertificate(cert); | 300 CERT_DestroyCertificate(cert); |
| 301 return ERR_UNEXPECTED; | 301 return ERR_UNEXPECTED; |
| 302 } | 302 } |
| 303 | 303 |
| 304 SECKEYPrivateKeyStr* private_key = NULL; | 304 SECKEYPrivateKeyStr* private_key = NULL; |
| 305 PK11SlotInfo *slot = base::GetDefaultNSSKeySlot(); | 305 PK11SlotInfo *slot = base::GetPrivateNSSKeySlot(); |
| 306 if (!slot) { | 306 if (!slot) { |
| 307 CERT_DestroyCertificate(cert); | 307 CERT_DestroyCertificate(cert); |
| 308 return ERR_UNEXPECTED; | 308 return ERR_UNEXPECTED; |
| 309 } | 309 } |
| 310 | 310 |
| 311 SECItem der_private_key_info; | 311 SECItem der_private_key_info; |
| 312 der_private_key_info.data = | 312 der_private_key_info.data = |
| 313 const_cast<unsigned char*>(&key_vector.front()); | 313 const_cast<unsigned char*>(&key_vector.front()); |
| 314 der_private_key_info.len = key_vector.size(); | 314 der_private_key_info.len = key_vector.size(); |
| 315 // The server's RSA private key must be imported into NSS with the | 315 // The server's RSA private key must be imported into NSS with the |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 // We must call EnsureOCSPInit() here, on the IO thread, to get the IO loop | 676 // We must call EnsureOCSPInit() here, on the IO thread, to get the IO loop |
| 677 // by MessageLoopForIO::current(). | 677 // by MessageLoopForIO::current(). |
| 678 // X509Certificate::Verify() runs on a worker thread of CertVerifier. | 678 // X509Certificate::Verify() runs on a worker thread of CertVerifier. |
| 679 EnsureOCSPInit(); | 679 EnsureOCSPInit(); |
| 680 #endif | 680 #endif |
| 681 | 681 |
| 682 return OK; | 682 return OK; |
| 683 } | 683 } |
| 684 | 684 |
| 685 } // namespace net | 685 } // namespace net |
| OLD | NEW |