From: Nick Zitzmann Date: Wed, 13 Nov 2013 02:18:04 +0000 (-0600) Subject: darwinssl: PKCS#12 import feature now requires Lion or later X-Git-Tag: curl-7_34_0~100 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf77101e5c132572a7abeeec1ae8b3b0174d2831;p=thirdparty%2Fcurl.git darwinssl: PKCS#12 import feature now requires Lion or later It turns out that some of the constants necessary to make this feature work are missing from Snow Leopard's Security framework even though they are defined in the headers. Bug: http://curl.haxx.se/mail/lib-2013-11/0076.html Reported by: myriachan --- diff --git a/docs/libcurl/curl_easy_setopt.3 b/docs/libcurl/curl_easy_setopt.3 index 0b507d8566..e6f9ea4f04 100644 --- a/docs/libcurl/curl_easy_setopt.3 +++ b/docs/libcurl/curl_easy_setopt.3 @@ -2375,7 +2375,7 @@ prefix, in order to avoid confusion with a nickname. Pass a pointer to a zero terminated string as parameter. The string should be the format of your certificate. Supported formats are "PEM" and "DER", except with Secure Transport. OpenSSL (versions 0.9.3 and later) and Secure Transport -(on iOS 5 or later, or OS X 10.6 or later) also support "P12" for +(on iOS 5 or later, or OS X 10.7 or later) also support "P12" for PKCS#12-encoded files. (Added in 7.9.3) .IP CURLOPT_SSLKEY Pass a pointer to a zero terminated string as parameter. The string should be diff --git a/lib/curl_darwinssl.c b/lib/curl_darwinssl.c index 45a668bdd3..25cf3d14d9 100644 --- a/lib/curl_darwinssl.c +++ b/lib/curl_darwinssl.c @@ -938,8 +938,10 @@ static OSStatus CopyIdentityFromPKCS12File(const char *cPath, cPassword, kCFStringEncodingUTF8) : NULL; CFDataRef pkcs_data = NULL; - /* We can import P12 files on iOS or OS X 10.6 or later: */ -#if CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS + /* We can import P12 files on iOS or OS X 10.7 or later: */ + /* These constants are documented as having first appeared in 10.6 but they + raise linker errors when used on that cat for some reason. */ +#if CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS if(CFURLCreateDataAndPropertiesFromResource(NULL, pkcs_url, &pkcs_data, NULL, NULL, &status)) { const void *cKeys[] = {kSecImportExportPassphrase}; @@ -963,7 +965,7 @@ static OSStatus CopyIdentityFromPKCS12File(const char *cPath, CFRelease(options); CFRelease(pkcs_data); } -#endif /* CURL_BUILD_MAC_10_6 || CURL_BUILD_IOS */ +#endif /* CURL_BUILD_MAC_10_7 || CURL_BUILD_IOS */ if(password) CFRelease(password); CFRelease(pkcs_url);