Skip to content

Commit

Permalink
Move SHA256 of empty string to constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
kbalthaser committed Dec 4, 2023
1 parent 1117010 commit 75cce6c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/opal-common/opal_common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def getSignatureKey(key, dateStamp, regionName, serviceName):
kSigning = sign(kService, "aws4_request")
return kSigning

# SHA256 of empty string. This is needed when S3 request payload is empty.
SHA256_EMPTY = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"

t = datetime.utcnow()
amzdate = t.strftime("%Y%m%dT%H%M%SZ")
datestamp = t.strftime("%Y%m%d")
Expand Down Expand Up @@ -138,7 +141,7 @@ def getSignatureKey(key, dateStamp, regionName, serviceName):

return {
"x-amz-date": amzdate,
"x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"x-amz-content-sha256": SHA256_EMPTY,
"Authorization": authorization_header,
}

Expand Down

0 comments on commit 75cce6c

Please sign in to comment.