CURLOPT_AWS_SIGV4.3 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.haxx.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_AWS_SIGV4 3 "January 02, 2023" "libcurl 7.88.1" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_AWS_SIGV4 \- V4 signature
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_AWS_SIGV4, char *param);
  32. .fi
  33. .SH DESCRIPTION
  34. Provides AWS V4 signature authentication on HTTP(S) header.
  35. .PP
  36. Pass a char * that is the collection of specific arguments are used for
  37. creating outgoing authentication headers. The format of the \fIparam\fP
  38. option is:
  39. .IP provider1[:provider2[:region[:service]]]
  40. .IP provider1,\ provider2
  41. The providers arguments are used for generating some authentication parameters
  42. such as "Algorithm", "date", "request type" and "signed headers".
  43. .IP region
  44. The argument is a geographic area of a resources collection.
  45. It is extracted from the host name specified in the URL if omitted.
  46. .IP service
  47. The argument is a function provided by a cloud.
  48. It is extracted from the host name specified in the URL if omitted.
  49. .PP
  50. NOTE: This call set \fICURLOPT_HTTPAUTH(3)\fP to CURLAUTH_AWS_SIGV4.
  51. Calling \fICURLOPT_HTTPAUTH(3)\fP with CURLAUTH_AWS_SIGV4 is the same
  52. as calling this with \fB"aws:amz"\fP in parameter.
  53. .PP
  54. Example with "Test:Try", when curl will do the algorithm, it will generate
  55. \fB"TEST-HMAC-SHA256"\fP for "Algorithm", \fB"x-try-date"\fP and
  56. \fB"X-Try-Date"\fP for "date", \fB"test4_request"\fP for "request type",
  57. \fB"SignedHeaders=content-type;host;x-try-date"\fP for "signed headers"
  58. .PP
  59. If you use just "test", instead of "test:try",
  60. test will be use for every strings generated
  61. .SH DEFAULT
  62. By default, the value of this parameter is NULL.
  63. Calling \fICURLOPT_HTTPAUTH(3)\fP with CURLAUTH_AWS_SIGV4 is the same
  64. as calling this with \fB"aws:amz"\fP in parameter.
  65. .SH PROTOCOLS
  66. HTTP
  67. .SH EXAMPLE
  68. .nf
  69. CURL *curl = curl_easy_init();
  70. struct curl_slist *list = NULL;
  71. if(curl) {
  72. curl_easy_setopt(curl, CURLOPT_URL,
  73. "https://service.region.example.com/uri");
  74. curl_easy_setopt(c, CURLOPT_AWS_SIGV4, "provider1:provider2");
  75. /* service and region also could be set in CURLOPT_AWS_SIGV4 */
  76. /*
  77. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/uri");
  78. curl_easy_setopt(c, CURLOPT_AWS_SIGV4,
  79. "provider1:provider2:region:service");
  80. */
  81. curl_easy_setopt(c, CURLOPT_USERPWD, "MY_ACCESS_KEY:MY_SECRET_KEY");
  82. curl_easy_perform(curl);
  83. }
  84. .fi
  85. .SH AVAILABILITY
  86. Added in 7.75.0
  87. .SH RETURN VALUE
  88. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  89. .SH NOTES
  90. This option overrides the other auth types you might have set in
  91. \fICURLOPT_HTTPAUTH(3)\fP which should be highlighted as this makes this auth
  92. method special. This method cannot be combined with other auth types.
  93. .PP
  94. A sha256 checksum of the request payload is used as input to the signature
  95. calculation. For POST requests, this is a checksum of the provided
  96. \fICURLOPT_POSTFIELDS(3)\fP. Otherwise, it's the checksum of an empty buffer.
  97. For requests like PUT, you can provide your own checksum in a HTTP header named
  98. \fBx-provider2-content-sha256\fP.
  99. .SH "SEE ALSO"
  100. .BR CURLOPT_HEADEROPT "(3), " CURLOPT_HTTPHEADER "(3), "