Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 9.5   10.0   10.1   10.2   10.3   10.4   10.5   11.0   11.1   11.2    Statistic    FMM    Blog  

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
MBS( "CURL.SetOptionCAINFO"; curl; Value { ; Encoding } )   More

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

Release notes

Example Databases

Blog Entries

FileMaker Magazin

Created 18th August 2014, last changed 12nd March 2020


CURL.SetOptionBufferSize - CURL.SetOptionCAPATH

Feedback: Report problem or ask question.




Links
MBS Xojo PDF Plugins

Start Chat