| 1234567891011121314151617181920212223 |
- from Crypto import Random
- from Crypto.PublicKey import RSA
- from Crypto.Cipher import PKCS1_v1_5 as PKCS1_cipher
- with open('public.rsa') as f:
- key = f.read()
- public_key = RSA.import_key(key)
- public_cipher = PKCS1_cipher.new(public_key)
- with open('private.rsa') as f:
- key = f.read()
- private_key = RSA.import_key(key)
- private_cipher = PKCS1_cipher.new(private_key)
- # print(public_key.exportKey().decode('utf-8'))
- # random_generator = Random.new().read
- # rsa = RSA.generate(2048, random_generator)
- # private_key = rsa.exportKey()
- # print(private_key.decode('utf-8'))
|