mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-08 15:44:11 +00:00
Allow arbitrary size AWS secret keys (#1648)
Previously s3fs limited these to 123 characters. Fixes #1626.
This commit is contained in:
parent
8ef01d37a9
commit
096a230b70
@ -2602,12 +2602,11 @@ std::string S3fsCurl::CalcSignature(const std::string& method, const std::string
|
||||
StringCQ += get_sorted_header_keys(requestHeaders) + "\n";
|
||||
StringCQ += payload_hash;
|
||||
|
||||
char kSecret[128];
|
||||
std::string kSecret = "AWS4" + S3fsCurl::AWSSecretAccessKey;
|
||||
unsigned char *kDate, *kRegion, *kService, *kSigning, *sRequest = NULL;
|
||||
unsigned int kDate_len,kRegion_len, kService_len, kSigning_len, sRequest_len = 0;
|
||||
int kSecret_len = snprintf(kSecret, sizeof(kSecret), "AWS4%s", S3fsCurl::AWSSecretAccessKey.c_str());
|
||||
|
||||
s3fs_HMAC256(kSecret, kSecret_len, reinterpret_cast<const unsigned char*>(strdate.data()), strdate.size(), &kDate, &kDate_len);
|
||||
s3fs_HMAC256(kSecret.c_str(), kSecret.size(), reinterpret_cast<const unsigned char*>(strdate.data()), strdate.size(), &kDate, &kDate_len);
|
||||
s3fs_HMAC256(kDate, kDate_len, reinterpret_cast<const unsigned char*>(endpoint.c_str()), endpoint.size(), &kRegion, &kRegion_len);
|
||||
s3fs_HMAC256(kRegion, kRegion_len, reinterpret_cast<const unsigned char*>("s3"), sizeof("s3") - 1, &kService, &kService_len);
|
||||
s3fs_HMAC256(kService, kService_len, reinterpret_cast<const unsigned char*>("aws4_request"), sizeof("aws4_request") - 1, &kSigning, &kSigning_len);
|
||||
|
Loading…
Reference in New Issue
Block a user