[New-bugs-announce] [issue37622] Signature of SHA256 HMAC digest not matching with the signature of jwt library

Dodain report at bugs.python.org
Thu Jul 18 10:44:19 EDT 2019


New submission from Dodain <moizimtiaz1 at gmail.com>:

The signature (SHA256 of HMAC Digest) calculated using hmac library doesn't match the signature calculated using jwt library. The singature calculated using JWT is the right signature.

The signature with JWT library is VXG8L0SEY3wo5hdAznbvxWXDbhNtuOd7PaZOhzZn_HQ

Whereas the signature with hmac library is 
SHR3SSe+8+X8eBw/H+CUc6f5KyXmuONfprdttjeQrwQ=


Since only one file can bu attached so I am inlining the code for finding jwt signature with jwt library. The code for HMAC library is attached. 

import jwt
public = "1234"
print (public)
print jwt.encode({"login":"admin"}, key=public, algorithm='HS256')

----------
components: Library (Lib)
files: sign_with_hmac_library.py
messages: 348119
nosy: dodain
priority: normal
severity: normal
status: open
title: Signature of SHA256 HMAC digest not matching with the signature of jwt library
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file48489/sign_with_hmac_library.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37622>
_______________________________________


More information about the New-bugs-announce mailing list