Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
CURL.SetOptionSSHAuthTypes
Sets the SSL authentication types.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 2.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
curl | The CURL session handle. | $curl |
Value | The new types. | 3 |
Result
Returns "OK" on success.
Description
Sets the SSL authentication types.Pass a number set to a bitmask consisting of one or more of CURLSSH_AUTH_PUBLICKEY, CURLSSH_AUTH_PASSWORD, CURLSSH_AUTH_HOST, CURLSSH_AUTH_KEYBOARD. Set CURLSSH_AUTH_ANY to let libcurl pick one.
CURLSSH_AUTH_ANY | -1 | all types supported by the server. |
CURLSSH_AUTH_NONE | 0 | none allowed, silly but complete. |
CURLSSH_AUTH_PUBLICKEY | 1 | public/private key files. |
CURLSSH_AUTH_PASSWORD | 2 | password. |
CURLSSH_AUTH_HOST | 4 | host key files. |
CURLSSH_AUTH_KEYBOARD | 8 | keyboard interactive. |
CURLSSH_AUTH_DEFAULT | -1 | default. |
See also SSH_AUTH_TYPES option in CURL manual.
Examples
Use password, no private key:
Set Variable [$r; Value: MBS( "CURL.SetOptionSSHAuthTypes"; $curl; 2+8 )]
Download file via SFTP to file on disk:
Set Variable [$curl; Value:MBS("CURL.New") ]
# set download URL, e.g. sftp://monkeybreadsoftware.net/test.jpg
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; SFTP Download::URL )]
# build file path on disk and open output file
Set Variable [$name; Value:GetValue(SFTP Download::FileName; 1)]
Set Variable [$path; Value:MBS( "Path.AddPathComponent"; SFTP Download::FolderPath; $name )]
Set Variable [$r; Value:MBS("CURL.CreateOutputFile"; $curl; $path)]
# login only via password
Set Variable [$result; Value:MBS( "CURL.SetOptionSSHAuthTypes"; $curl; 2+8 )]
# set credentials
Set Variable [$result; Value:MBS("CURL.SetOptionUserName"; $curl; SFTP Download::UserName )]
Set Variable [$result; Value:MBS("CURL.SetOptionPassword"; $curl; SFTP Download::Password )]
# run transfer
Set Field [SFTP Download::ErrorCode; MBS("CURL.Perform"; $curl)]
# check debug log for errors
Set Field [SFTP Download::Debug; MBS("CURL.GetDebugMessages"; $curl)]
# free CURL session
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]
See also
- CURL.SetInputText
- CURL.SetOptionFTPCreateMissingDirs
- CURL.SetOptionPassword
- CURL.SetOptionQuote
- CURL.SetOptionSASLAuthZID
- CURL.SetOptionSSHPrivateKeyfile
- CURL.SetOptionSSLCertType
- CURL.SetOptionSSLKeyType
- CURL.SetOptionURL
- CURL.SetOptionUserName
Example Databases
Blog Entries
Created 18th August 2014, last changed 15th January 2023