1CURLOPT_AWS_SIGV4(3) libcurl CURLOPT_AWS_SIGV4(3)
2
3
4
6 CURLOPT_AWS_SIGV4 - V4 signature
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AWS_SIGV4, char *param);
12
14 Provides AWS V4 signature authentication on HTTP(S) header.
15
16 Pass a char * that is the collection of specific arguments are used for
17 creating outgoing authentication headers. The format of the param op‐
18 tion is:
19
20 provider1[:provider2[:region[:service]]]
21
22 provider1, provider2
23 The providers arguments are used for generating some authentica‐
24 tion parameters such as "Algorithm", "date", "request type" and
25 "signed headers".
26
27 region The argument is a geographic area of a resources collection. It
28 is extracted from the host name specified in the URL if omitted.
29
30 service
31 The argument is a function provided by a cloud. It is extracted
32 from the host name specified in the URL if omitted.
33
34 NOTE: This call set CURLOPT_HTTPAUTH(3) to CURLAUTH_AWS_SIGV4. Calling
35 CURLOPT_HTTPAUTH(3) with CURLAUTH_AWS_SIGV4 is the same as calling this
36 with "aws:amz" in parameter.
37
38 Example with "Test:Try", when curl will do the algorithm, it will gen‐
39 erate "TEST-HMAC-SHA256" for "Algorithm", "x-try-date" and "X-Try-Date"
40 for "date", "test4_request" for "request type", "SignedHeaders=content-
41 type;host;x-try-date" for "signed headers"
42
43 If you use just "test", instead of "test:try", test will be use for ev‐
44 ery strings generated
45
47 By default, the value of this parameter is NULL. Calling CUR‐
48 LOPT_HTTPAUTH(3) with CURLAUTH_AWS_SIGV4 is the same as calling this
49 with "aws:amz" in parameter.
50
52 HTTP
53
55 CURL *curl = curl_easy_init();
56
57 if(curl) {
58 curl_easy_setopt(curl, CURLOPT_URL,
59 "https://service.region.example.com/uri");
60 curl_easy_setopt(c, CURLOPT_AWS_SIGV4, "provider1:provider2");
61
62 /* service and region can also be set in CURLOPT_AWS_SIGV4 */
63 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/uri");
64 curl_easy_setopt(c, CURLOPT_AWS_SIGV4,
65 "provider1:provider2:region:service");
66
67 curl_easy_setopt(c, CURLOPT_USERPWD, "MY_ACCESS_KEY:MY_SECRET_KEY");
68 curl_easy_perform(curl);
69 }
70
72 Added in 7.75.0
73
75 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
76 if not.
77
79 This option overrides the other auth types you might have set in CUR‐
80 LOPT_HTTPAUTH(3) which should be highlighted as this makes this auth
81 method special. This method cannot be combined with other auth types.
82
83 A sha256 checksum of the request payload is used as input to the signa‐
84 ture calculation. For POST requests, this is a checksum of the pro‐
85 vided CURLOPT_POSTFIELDS(3). Otherwise, it's the checksum of an empty
86 buffer. For requests like PUT, you can provide your own checksum in an
87 HTTP header named x-provider2-content-sha256.
88
89 For aws:s3, a x-amz-content-sha256 header is added to every request if
90 not already present. For s3 requests with unknown payload, this header
91 takes the special value "UNSIGNED-PAYLOAD".
92
94 CURLOPT_HEADEROPT(3), CURLOPT_HTTPHEADER(3),
95
96
97
98ibcurl 8.2.1 June 12, 2023 CURLOPT_AWS_SIGV4(3)