Merge pull request #3964 from satherton/fix-blob-key-length

Bug fix, blob client was not correctly using keys longer than 64 byte…
This commit is contained in:
Russell Sears 2020-10-27 08:33:07 -07:00 committed by GitHub
commit 622985a4cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -873,7 +873,12 @@ Future<BlobStoreEndpoint::ListResult> BlobStoreEndpoint::listBucket(std::string
std::string BlobStoreEndpoint::hmac_sha1(std::string const &msg) {
std::string key = secret;
// First pad the key to 64 bytes.
// Hash key to shorten it if it is longer than SHA1 block size
if(key.size() > 64) {
key = SHA1::from_string(key);
}
// Pad key up to SHA1 block size if needed
key.append(64 - key.size(), '\0');
std::string kipad = key;