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

Unified Diff: net/ssl/ssl_platform_key_mac.cc

Issue 2746103003: Add X509CertificateBytes which uses CRYPTO_BUFFER instead of macOS-native certificate types. (Closed)
Patch Set: rebase Created 3 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ssl/client_cert_store_mac.cc ('k') | net/ssl/ssl_platform_key_mac_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_platform_key_mac.cc
diff --git a/net/ssl/ssl_platform_key_mac.cc b/net/ssl/ssl_platform_key_mac.cc
index 373f4323e0709c571a40501e1fc8207ea6444cc8..1f7e3efd5b318278b0c18ba24bc5fcda711edc9e 100644
--- a/net/ssl/ssl_platform_key_mac.cc
+++ b/net/ssl/ssl_platform_key_mac.cc
@@ -30,6 +30,7 @@
#include "crypto/openssl_util.h"
#include "net/base/net_errors.h"
#include "net/cert/x509_certificate.h"
+#include "net/cert/x509_util_mac.h"
#include "net/ssl/ssl_platform_key.h"
#include "net/ssl/ssl_platform_key_util.h"
#include "net/ssl/ssl_private_key.h"
@@ -84,9 +85,13 @@ SecKeyRef FetchSecKeyRefForCertificate(const X509Certificate* certificate,
OSStatus status;
base::ScopedCFTypeRef<SecIdentityRef> identity;
{
+ base::ScopedCFTypeRef<SecCertificateRef> os_cert(
+ x509_util::CreateSecCertificateFromX509Certificate(certificate));
+ if (!os_cert)
+ return nullptr;
base::AutoLock lock(crypto::GetMacSecurityServicesLock());
- status = SecIdentityCreateWithCertificate(
- keychain, certificate->os_cert_handle(), identity.InitializeInto());
+ status = SecIdentityCreateWithCertificate(keychain, os_cert.get(),
+ identity.InitializeInto());
}
if (status != noErr) {
OSSTATUS_LOG(WARNING, status);
« no previous file with comments | « net/ssl/client_cert_store_mac.cc ('k') | net/ssl/ssl_platform_key_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698