This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
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
process
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 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sign_with_hmac_library.py 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 
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')
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.
History
Date User Action Args
2022-04-11 14:59:18adminsetgithub: 81803
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