Platforms to show: All Mac Windows Linux Cross-Platform
Back to CURLSMBS class.
CURLSMBS.SetupAWS(AWSAccessKeyId as String, AWSSecretAccessKey as String, Region as String, Service as String, Path as String, Domain as String, Verb as String, HashedPayload as String = "", Headers() as String = nil, queryParameters() as string = nil, NoSSL as boolean = false) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CURL | MBS CURL Plugin | 17.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
This implements AWS4-HMAC-SHA256 signature for credentials, sets authentication, URL, HTTP Headers and other parameters.
For upload or post, please set input parameters first.
AWSAccessKeyId | Your access key for AWS. | |
AWSSecretAccessKey | Your secret. | |
Region | The region to use. | "eu-central-1" |
Service | The service to use. | "s3" |
Path | The path for the URL. Should always start with "/". | "/test.jpg" |
Domain | Optional the domain to use. By default we just build it from region and service. | "s3.eu-central-1.amazonaws.com" or "s3-ap-southeast-2.amazonaws.com" |
Verb | The HTTP Operation to do. Can be POST, PUT, PATCH, GET or DELETE. | "PUT" |
HashedPayload | The hashed payload. If empty, we calculate it automatically from input data or postfields. This is a lowercase hex SHA256. | |
Headers | Optional extra HTTP headers to include. | "x-amz-acl: public-read" |
queryParameters | Optional query parameter list with entries like "key=value", URL encoded. |
Returns true on success or false on failure.
Throws exceptions when parameters are insufficient (UnsupportedOperationException).
Works also for other compatible S3 services beside Amazon's like the one from Wasabi or Dell ECS.
Added PATCH as verb in version 23.0.
Please be aware that this function depends on a correct time and date set on the computer. If the time is not set correct, the authentication will fail.
Some examples using this method:
CURLSMBS.SetupOAuth(ConsumerKey as String, ConsumerSecret as String, AccessToken as String, AccessTokenSecret as String, HTTPVerb as String, URL as String, Parameters() as String = nil, Headers() as String = nil, Datas() as String = nil, Nonce as String = "", Timestamp as String = "", HMAC as String = "", Verifier as String = "", Realm as String = "") as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CURL | MBS CURL Plugin | 18.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
The plugin calculates the signature and adds headers for authorization to the CURL handle.
Sets URL with parameters and optionally data values for POST.
Parameter | Description | Example |
ConsumerKey | The oauth consumer key. | "xvz1evFS4wEEPTGEFPHBog" |
ConsumerSecret | The oauth consumer secret. | "kAcSOqF21Fu85e7zjz7ZN2U4ZRhfV3WpwPAoE3Z7kBw" |
AccessToken | The oauth access token. | "370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb" |
AccessTokenSecret | The oauth access token secret. Can be empty if not yet known. | "LswwdoUaIvS8ltyTt5jkRh4J50vUPVVHtR2YPi5kE" |
HTTPVerb | The HTTP verb. e.g. POST, PUT, GET, DELETE. Default if empty is GET. | "POST" |
URL | The URL to query without parameters. | "https://api.twitter.com/1.1/statuses/update.json" |
Parameters | List of parameters. Can be empty. Please pass list with newline as delimiter. Values should be URL encoded already. | "include_entities=true" |
Headers | List of additional header entries to include. Can be empty. We automatically set Authorization header. | "Accept: application/json¶Content-Type: application/json" |
Datas | Data value list for POST. | "status=Hello¶others=123" |
Nonce | The nonce value. If empty, we generate it automatically for you. | "kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg" |
Timestamp | The timestamp to use for signature. If empty, we query current timestamp (same as you calling Time.UnixTimeStamp) | 1318622958 |
HMAC | Which HMAC algorithm to use. Can be HMAC-SHA512, HMAC-SHA256 or HMAC-SHA1. Default is HMAC-SHA1 if parameter is missing or empty. | "HMAC-SHA1" |
Verifier | The verifier. Usually an ID shown on a website after login to the service and authorization of an app. | "3456789" |
Added Realm parameter for version 20.5.
Some examples using this method:
CURLSMBS.UseSystemCertificates as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CURL | MBS CURL Plugin | 17.2 | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes | All |
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.
The items on this page are in the following plugins: MBS CURL Plugin.