10000 Use SHA256 for OAuth · factorlibre/wc-api-python@c3ef8b8 · GitHub
[go: up one dir, main page]

Skip to content

Commit c3ef8b8

Browse files
Use SHA256 for OAuth
1 parent 13c15ac commit c3ef8b8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

woocommerce/oauth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_oauth_url(self):
4242
params["oauth_timestamp"] = int(time.time())
4343
params["oauth_nonce"] = hmac.new(
4444
str(time.time() + random.randint(0, 99999)), "SHA1").hexdigest()
45-
params["oauth_signature_method"] = "HMAC-SHA1"
45+
params["oauth_signature_method"] = "HMAC-SHA256"
4646
params["oauth_signature"] = self.generate_oauth_signature(params, url)
4747

4848
query_string = urllib.urlencode(params)
@@ -70,7 +70,7 @@ def generate_oauth_signature(self, params, url):
7070
hash_signature = hmac.new(
7171
consumer_secret,
7272
str(string_to_sign),
73-
getattr(hashlib, "sha1")).digest()
73+
getattr(hashlib, "sha256")).digest()
7474

7575
return hash_signature.encode("base64").replace("\n", "")
7676

0 commit comments

Comments
 (0)
0