![]() Read key from file: file = open('external.pem','r')Īnd your external key format must be something like this: -BEGIN PUBLIC KEY. If you want to import an external key using RSA.importkey( ), you have two options: KeyPriv = RSA.importKey(prvkey) # import the private keyĭecrypt_text = crypt(cipher_text, None).decode() KeyPub = RSA.importKey(pubkey) # import the public keyĬipher_text = cipher.encrypt(msg.encode()) # now we have the cipher Prvkey = """-BEGIN RSA PRIVATE KEY-įrom Crypto.Cipher import PKCS1_v1_5 as Cipher_PKCS1_v1_5 ![]() Here's my code, encrypt end decrypt, the key was from someone's blog.(if U occured with "ValueError: RSA key format is not supported", check the key format, it should be warpped with some thing like "-BEGIN XXXX KEY-") pubkey = """-BEGIN PUBLIC KEY.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |