| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ssl/ssl_platform_key.h" | 5 #include "net/ssl/ssl_platform_key.h" |
| 6 | 6 |
| 7 #include <Security/cssm.h> | 7 #include <Security/cssm.h> |
| 8 #include <Security/SecBase.h> | 8 #include <Security/SecBase.h> |
| 9 #include <Security/SecCertificate.h> | 9 #include <Security/SecCertificate.h> |
| 10 #include <Security/SecIdentity.h> | 10 #include <Security/SecIdentity.h> |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey( | 214 scoped_refptr<SSLPrivateKey> FetchClientCertPrivateKey( |
| 215 X509Certificate* certificate) { | 215 X509Certificate* certificate) { |
| 216 // Look up the private key. | 216 // Look up the private key. |
| 217 base::ScopedCFTypeRef<SecKeyRef> private_key( | 217 base::ScopedCFTypeRef<SecKeyRef> private_key( |
| 218 FetchSecKeyRefForCertificate(certificate)); | 218 FetchSecKeyRefForCertificate(certificate)); |
| 219 if (!private_key) | 219 if (!private_key) |
| 220 return nullptr; | 220 return nullptr; |
| 221 | 221 |
| 222 const CSSM_KEY* cssm_key; | 222 const CSSM_KEY* cssm_key; |
| 223 OSStatus status = SecKeyGetCSSMKey(private_key.get(), &cssm_key); | 223 OSStatus status = SecKeyGetCSSMKey(private_key.get(), &cssm_key); |
| 224 if (status != noErr) | 224 if (status != noErr) { |
| 225 OSSTATUS_LOG(WARNING, status); |
| 225 return nullptr; | 226 return nullptr; |
| 227 } |
| 226 | 228 |
| 227 SSLPrivateKey::Type key_type; | 229 SSLPrivateKey::Type key_type; |
| 228 size_t max_length; | 230 size_t max_length; |
| 229 if (!GetClientCertInfo(certificate, &key_type, &max_length)) | 231 if (!GetClientCertInfo(certificate, &key_type, &max_length)) |
| 230 return nullptr; | 232 return nullptr; |
| 231 | 233 |
| 232 return make_scoped_refptr(new ThreadedSSLPrivateKey( | 234 return make_scoped_refptr(new ThreadedSSLPrivateKey( |
| 233 base::MakeUnique<SSLPlatformKeyMac>(key_type, max_length, | 235 base::MakeUnique<SSLPlatformKeyMac>(key_type, max_length, |
| 234 private_key.get(), cssm_key), | 236 private_key.get(), cssm_key), |
| 235 GetSSLPlatformKeyTaskRunner())); | 237 GetSSLPlatformKeyTaskRunner())); |
| 236 } | 238 } |
| 237 | 239 |
| 238 #pragma clang diagnostic pop // "-Wdeprecated-declarations" | 240 #pragma clang diagnostic pop // "-Wdeprecated-declarations" |
| 239 | 241 |
| 240 } // namespace net | 242 } // namespace net |
| OLD | NEW |