]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http_aws_sigv4: add additional verbose log statements
authorNigel Brittain <nbaws@amazon.com>
Thu, 3 Apr 2025 22:42:04 +0000 (22:42 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 4 Apr 2025 06:54:09 +0000 (08:54 +0200)
To use curl as a tool for troubleshooting SigV4 signing, it is useful to
have the 'Canonical Request', 'String To Sign' and 'Signature'
calculations output.

Closes #16952

lib/http_aws_sigv4.c

index d73ac43d75383e6d55d3a47f2a8287a4c8b8065c..c255ddcb0c2bf08ad62fdc879e022e9e4c0869c8 100644 (file)
@@ -813,7 +813,8 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
   if(!canonical_request)
     goto fail;
 
-  DEBUGF(infof(data, "Canonical request: %s", canonical_request));
+  infof(data, "aws_sigv4: Canonical request (enclosed in []) - [%s]",
+    canonical_request);
 
   request_type = aprintf("%.*s4_request",
                          (int)Curl_strlen(&provider0), Curl_str(&provider0));
@@ -855,6 +856,9 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
   /* make provider0 part done uppercase */
   Curl_strntoupper(str_to_sign, Curl_str(&provider0), Curl_strlen(&provider0));
 
+  infof(data, "aws_sigv4: String to sign (enclosed in []) - [%s]",
+    str_to_sign);
+
   secret = aprintf("%.*s4%s", (int)Curl_strlen(&provider0),
                    Curl_str(&provider0), data->state.aptr.passwd ?
                    data->state.aptr.passwd : "");
@@ -873,6 +877,8 @@ CURLcode Curl_output_aws_sigv4(struct Curl_easy *data)
 
   sha256_to_hex(sha_hex, sign0);
 
+  infof(data, "aws_sigv4: Signature - %s", sha_hex);
+
   auth_headers = aprintf("Authorization: %.*s4-HMAC-SHA256 "
                          "Credential=%s/%s, "
                          "SignedHeaders=%s, "