Bug fix, blob client was not correctly using keys longer than 64 bytes in request signing.

This commit is contained in:
Steve Atherton 2020-10-25 21:11:04 -07:00
parent b0d78ecf37
commit 9501edb960
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;