Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

CURL.SetOptionSSLKey

Sets the file path for the private key.

Component Version macOS Windows Linux Server iOS SDK
CURL 2.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionSSLKey"; curl; Value { ; Encoding } )   More

Parameters

Parameter Description Example Flags
curl The CURL session handle. $curl
Value The private key file path. "/tmp/test.pem"
Encoding The text encoding for text parameter.
Default is UTF-8.
Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ.
"UTF8" Optional

Result

Returns "OK" on success.

Description

Sets the file path for the private key.
Pass a string as parameter. The string should be the file name of your private key. The default format is "PEM" and can be changed with CURL.SetOptionSSLKeyType.

Starting with version 8.0 the plugin will always use UTF-8 encoding for file path on Linux and macOS. For macOS we also do the unicode character normalization for file names for you.

See CURL.SetOptionSSLKeyBlob to pass certificate as container or text.

See Files.DeleteLater to delete a temporary key file when FileMaker quits.

See also SSLKEY option in CURL manual.

Examples

Set private key:

MBS( "CURL.SetOptionSSLKey"; $curl; $cacertPath )

Send request to Apple's gsx webservice:

Set Variable [$XMLRequest; Value:""]
#Start new session
Set Variable [$curl; Value:MBS("CURL.New")]
# URL for web service
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; "https://gsxapiut.apple.com:443/gsx-ws/services/emea/asp")]
# Mark content as XML
Set Variable [$result; Value:MBS("CURL.SetOptionHTTPHeader"; $curl; "Content-Type: text/xml; charset=UTF-8")]
# Pass XML content for request
Set Variable [$result; Value:MBS("CURL.SetOptionPostFields"; $curl; $XMLRequest)]
# Certificate and private key in one file
Set Variable [$result; Value:MBS("CURL.SetOptionSSLCert"; $curl; "/Users/cs/Keys/apple-cert+key.pem")]
# Root certificates
Set Variable [$result; Value:MBS("CURL.SetOptionCAInfo"; $curl; "/Users/cs/Keys/cacert.pem")]
# SSL Key is in PEM Format
Set Variable [$result; Value:MBS("CURL.SetOptionSSLCertType"; $curl; "PEM")]
# Password for key file
Set Variable [$result; Value:MBS("CURL.SetOptionKeyPassword"; $curl; "xxx")]
# SSL Verification on
Set Variable [$result; Value:MBS("CURL.SetOptionSSLVerifyPeer"; $curl; 1)]
Set Variable [$result; Value:MBS("CURL.SetOptionSSLVerifyHost"; $curl; 1)]
# use TLS v1.2
Set Variable [$result; Value:MBS("CURL.SetOptionSSLVersion"; $curl; 6)]
#RUN now
Set Field [CURL Test::Result; MBS("CURL.Perform"; $curl)]
#Check result
Set Field [CURL Test::Text; MBS("CURL.GetResultAsText"; $curl; "UTF8")]
Set Field [CURL Test::debug; MBS("CURL.GetDebugMessages"; $curl)]
#Cleanup
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]

See also

Release notes

Blog Entries

Created 18th August 2014, last changed 7th August 2023


CURL.SetOptionSSLFalseStart - CURL.SetOptionSSLKeyBlob