Python rsa decrypt with public key8/10/2023 ![]() ![]() > ciphertext = pkey.public_key().encrypt(b"asdasd", padding.PKCS1v15()) pkey = serialization.load_pem_private_key(key_file.read(), password=None, backend=default_backend()) Also, if you control the full stack - from encryption to decryption - stop doing it this way. You should be sure you understand what's going with these operations before you rely on the code to provide any kind of security. ![]() Before you do, note that it's very easy to shoot yourself in the foot with the hazmat layer and the cryptography team won't apologize if you do. You can do this with the cryptography library's hazmat layer (note that cryptography is now the back-end library used by pyOpenSSL while pyOpenSSL is convenient for some uses, cryptography provides a much more complete OpenSSL binding as well as useful higher-level (safer, better) cryptographic primitives and bindings to other cryptographic libraries as well). ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |