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 |
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
- CURL.SetOptionProxy
- CURL.SetOptionProxySSLKey
- CURL.SetOptionQuote
- CURL.SetOptionSASLIR
- CURL.SetOptionSSLCert
- CURL.SetOptionSSLKeyBlob
- CURL.SetOptionSSLKeyType
- CURL.SetOptionSSLVersion
- CURL.SetOptionURL
- Files.DeleteLater
Release notes
- Version 11.2
- Fixed a problem in CURL with CURL.SetOptionSSLKeyBlob function not working correctly.
- Version 10.4
- Changed CURL.SetOptionIssuerCertBlob, CURL.SetOptionProxyIssuerCert, CURL.SetOptionProxyIssuerCertBlob, CURL.SetOptionProxySSLCertBlob, CURL.SetOptionProxySSLKeyBlob, CURL.SetOptionSSLCertBlob and CURL.SetOptionSSLKeyBlob to replace line endings for keys to LF if needed.
- Version 10.3
- Version 8.0
- Changed CURL.SetOptionCAINFO, CURL.SetOptionCAPATH, CURL.SetOptionCookieFile, CURL.SetOptionCookieJar, CURL.SetOptionIssuerCert, CURL.SetOptionNETRCFile, CURL.SetOptionRandomFile, CURL.SetOptionSSHPrivateKeyfile, CURL.SetOptionSSHPublicKeyfile, CURL.SetOptionSSLCert, CURL.SetOptionSSLKey to use always UTF-8 on Mac/Linux and on Mac do the unicode transformation for decomposed characters to avoid trouble with special characters in file paths.
Blog Entries
- Translating Insert from URL options for CURL to MBS Plugin calls
- MBS FileMaker Plugin, version 7.6pr3
Created 18th August 2014, last changed 7th August 2023
