Skip to content

Instantly share code, notes, and snippets.

Avatar

Mohammad Reza Eram mreram

  • Tehran
View GitHub Profile
View Python PyCrypto: Sign Data Example.py
def sign_data(private_key_loc, data):
'''
param: private_key_loc Path to your private key
param: package Data to be signed
return: base64 encoded signature
'''
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from Crypto.Hash import SHA256
from base64 import b64encode, b64decode