How to use RSA-SHA256 in python using private key

124 views
Skip to first unread message

prakash sharma

unread,
Aug 5, 2018, 4:44:22 PM8/5/18
to Django users
Hi all,
I am stuck while salesforce jwt-bearer auth.
I need help in this code section:

String key='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

Blob privateKey = EncodingUtil.base64Decode(key);

String signature = System.encodingUtil.base64Encode(
    Crypto.sign('RSA-SHA256', Blob.valueOf(jwtRequest), privateKey)).replace('+', '-').replace('/', '_');



I have tried python code but this is not working

import hmac,hashlib
from base64 import b64encode, b64decode 
res = hmac.new(input_key,message, digestmod=hashlib.sha256).hexdigest()


Please help


Reply all
Reply to author
Forward
0 new messages