Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
CURL.SetOptionCAInfo
Sets a path to find certificate file.
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 file path for the certificates. | "/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 a path to find certificate file.Pass a string naming a file holding one or more certificates to verify the peer with. This makes sense only when used in combination with the CURL.SetOptionVerifyPeer option. If CURL.SetOptionVerifyPeer is zero, CURL.SetOptionCAInfo need not even indicate an accessible file.
This option is by default set to the system path where libCURL's cacert bundle is assumed to be stored, as established at build time.
When built against NSS, this is the directory that the NSS certificate database resides in.
see also
http://www.mbsplugins.de/archive/2013-01-31/SSL_Security_with_CURL/monkeybreadsoftware_blog_archive
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 also CAINFO option in CURL manual.
Examples
Enables verification and uses cacert.pem file for certificates:
MBS( "CURL.SetOptionCAInfo"; $curl; $cacertPath )
MBS( "CURL.SetOptionSSLVerifyHost"; $curl; 2 )
MBS( "CURL.SetOptionSSLVerifyPeer"; $curl; 1 )
Use FileMaker's root file in CURL:
Set Variable [ $curl ; Value: MBS("CURL.New") ]
#
If [ MBS("IsIOS") ]
# look for path to certificate file
Set Variable [ $path ; Value: Substitute(MBS("Folders.UserDocuments"); "/Documents"; "/Library/Application Support/FileMaker/iOS/1.0/root.pem") ]
If [ MBS("Files.FileExists"; $path) ]
# use in CURL
Set Variable [ $r ; Value: MBS( "CURL.SetOptionCAINFO"; $curl; $path) ]
Else
Show Custom Dialog [ "File not found." ; $path ]
End If
Else If [ MBS("IsMacOSX") ]
# look for path to certificate file
Set Variable [ $path ; Value: Substitute(MBS("Folders.UserDocuments"); "/Documents"; "/Library/Application Support/FileMaker/Shared/17.0/root.pem") ]
If [ MBS("Files.FileExists"; $path) ]
# use in CURL
Set Variable [ $r ; Value: MBS( "CURL.SetOptionCAINFO"; $curl; $path) ]
Else
Show Custom Dialog [ "File not found." ; $path ]
End If
Else If [ MBS("IsWindows") ]
# look for path to certificate file
Set Variable [ $path ; Value: Substitute(MBS("Folders.UserDocuments"); "\Documents"; "\AppData\Local\FileMaker\FileMaker Pro Advanced\17.0\root.pem") ]
If [ MBS("Files.FileExists"; $path) ]
# use in CURL
Set Variable [ $r ; Value: MBS( "CURL.SetOptionCAINFO"; $curl; $path) ]
Else
Show Custom Dialog [ "File not found." ; $path ]
End If
Else If [ MBS("IsLinux") ]
# look for path to certificate file
Set Variable [ $path ; Value: "/FileMakerData/Extensions/OpenSSL/root.pem" ]
# use in CURL
Set Variable [ $r ; Value: MBS( "CURL.SetOptionCAINFO"; $curl; $path) ]
End If
See also
- CURL.SetOptionCAInfoBlob
- CURL.SetOptionCAPATH
- CURL.SetOptionCookie
- CURL.SetOptionCRLF
- CURL.SetOptionProxyCAInfo
- CURL.SetOptionRange
- CURL.SetOptionSSLVerifyPeer
- Folders.UserDocuments
- IsIOS
- IsLinux
Release notes
- Version 11.3
- Added CURL.SetOptionCAInfoBlob and CURL.SetOptionProxyCAInfoBlob functions.
- 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.
Example Databases
- CURL/Email/Batch Emailer
- CURL/Email/Build and send Email
- CURL/Email/Build and send HTML Email with inline graphics
- CURL/Email/IMAP Email Upload
- CURL/Email/Office 365 oAuth SMTP
- CURL/WebServices/Magento2 REST API
Blog Entries
- Sending email with a huge custom function
- GMail for emails with MBS Plugin
- Using Apple's Global Service Exchange web service in FileMaker
- Use root certificates included with FileMaker
- Upload email to Sent folder via IMAP
- MBS FileMaker Plugin, version 7.6pr3
- Using Apple's Global Service Exchange web service in FileMaker
- Sending emails in FileMaker with MBS Plugin
- Sending Email with FileMaker via MBS Plugin
FileMaker Magazin
Created 18th August 2014, last changed 26th May 2021