Title: Signature of SHA256 HMAC digest not matching with the signature of jwt library
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, dodain
Priority: normal Keywords:

Created on 2019-07-18 14:44 by dodain, last changed 2019-07-21 01:25 by benjamin.peterson. This issue is now closed.

File name Uploaded Description Edit dodain, 2019-07-18 14:44 Sample code of signature found using hmac library
Messages (2)
msg348119 - (view) Author: Dodain (dodain) Date: 2019-07-18 14:44
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 

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')
msg348224 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2019-07-21 01:25
Please describe which function of the stdlib you believe is broken. It's very likely that your framing code is incorrect.
Date User Action Args
2019-07-21 01:25:10benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg348224

resolution: not a bug
stage: resolved
2019-07-18 14:44:19dodaincreate