Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.

Commit cbcf845

Browse files
committed
Throw exception on algorithm signature parameter and dervice algorithm mismatch
1 parent abac139 commit cbcf845

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

httpsig/verify.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def __init__(self, headers, secret, required_headers=None, method=None,
9696
self.path = path
9797
self.host = host
9898

99+
if 'algorithm' in self.auth_dict and self.auth_dict['algorithm'] != self.algorithm:
100+
raise HttpSigException(
101+
"Algorithm mismath, signature parameter algorithm was: {}, but algorithm dervice from key is: {}".format(
102+
self.auth_dict['algorithm'], self.algorithm))
103+
99104
if self.auth_dict['algorithm'] != DEFAULT_ALGORITHM:
100105
print("Algorithm: {} is deprecated please update to {}".format(self.auth_dict['algorithm'], DEFAULT_ALGORITHM))
101106
elif self.auth_dict['algorithm'] == DEFAULT_ALGORITHM and sign_algorithm is None:

0 commit comments

Comments
 (0)