Skip to content

Commit d7590ba

Browse files
Update src/cryptojwt/jwk/hmac.py
Co-authored-by: Giuseppe De Marco <demarcog83@gmail.com>
1 parent 3092472 commit d7590ba

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cryptojwt/jwk/hmac.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ def __init__(
6262
elif self.key and not self.k:
6363
self.k = b64e(self.key)
6464

65-
if self.k and self.key and self.k != b64e(self.key):
66-
raise JWKException("k and key don't match")
65+
if self.k and self.key:
66+
_k_bytes = self.k.encode("utf-8") if isinstance(self.k, str) else self.k
67+
if _k_bytes != b64e(self.key):
68+
raise JWKException("k and key don't match")
6769

6870
if len(self.key) < 16:
6971
raise UnsupportedAlgorithm("client_secret too short, it should be at least 16 digits")

0 commit comments

Comments
 (0)