![]() Your method of saving the private key throws away the newlines which load_pem_private_key() expects to see. Private_key = serialization.load_pem_private_key( With open(os.path.join(_location_, 'key.pem'), "rb") as key_file: ValueError: Could not deserialize key data. This is my current try, but I get an error. Since Cryptography is still new for me, I would like to know the correct way of storing RSA keys in a file. By just storing the pem_data in a file and later on loading from that file with I know how to generate keys, but how can I save correctly to a file. Mgf=padding.MGF1(algorithm=hashes.SHA1()),įormat=,Įncryption_algorithm=serialization.NoEncryption() # Working RSA encryption you can run for yourself from import default_backendįrom import rsaįrom import serializationįrom import hashesįrom import padding I want to save my generated private key in a file, to use it later on.īut from the docs I was unable to find the method needed for this. Using the Cryptography module for Python,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |