Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.0   8.1   8.2   8.3   8.4   8.5   9.0   9.1   9.2   9.3    Statistic  

CURL.UseSystemCertificates

Read certificate from system and installs them in CURL session,.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
CURL 7.2 Yes Yes Yes No No
MBS( "CURL.UseSystemCertificates"; curl )   More

Parameters

Parameter Description Example value
curl The CURL session handle. $curl

Result

Returns number or error.

Description

Read certificate from system and installs them in CURL session,.
For macOS and Windows we load the available certificates from keychain or Windows Certificate Store and pass them to CURL. This is better than having no certificates at all.
Even better is normally to provide a cacert.pem file with only the expected certificates.
Returns number of certificates loaded.

Examples

Enable system certificates:

Set Variable [$result; Value:MBS("CURL.UseSystemCertificates"; $curl)]
Set Variable [$result; Value:MBS("CURL.SetOptionSSLVerifyPeer"; $curl; 1)]
Set Variable [$result; Value:MBS("CURL.SetOptionSSLVerifyHost"; $curl; 2 )]

Do download with TLS and system certificates:

# Start new session
Set Variable [ $curl ; Value: MBS("CURL.New") ]
# Set URL to load (HTTP, HTTPS, FTP, FTPS, SFTP, etc.)
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; CURL Test::URL) ]
# Use system certificate store for TLS
Set Variable [ $result ; Value: MBS( "CURL.UseSystemCertificates"; $curl ) ]
# 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.GetDebugAsText"; $curl) ]
# Cleanup
Set Variable [ $result ; Value: MBS("CURL.Cleanup"; $curl) ]

See also

Blog Entries

Created 19th March 2017, last changed 12nd July 2019


CURL.Upkeep   -   CURL.Version

Feedback: Report problem or ask question.




Links
MBS Xojo Plugins