Created
November 7, 2017 16:23
-
-
Save strategicpause/48af655bd8bc011d96e1897082965784 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Crypto.PublicKey import RSA | |
from Crypto import Random | |
from Crypto.Cipher import PKCS1_OAEP | |
from Crypto.Signature import PKCS1_v1_5 | |
from Crypto.Hash import SHA256 | |
from base64 import b64encode, b64decode | |
random_generator = Random.new().read | |
key = RSA.generate(1024, random_generator) | |
digest = SHA256.new("Hello".encode("UTF8")) | |
signer = PKCS1_v1_5.new(key) | |
signature = signer.sign(digest) | |
print(b64encode(signature)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment