Skip to content Skip to sidebar Skip to footer

Pycrypto: Decrypt Only With Public Key In File (no Private+public Key)

Hello everyone. I am trying to play a bit with RSA public and private keys and encryption/decryption with PyCrypto and I have encountered and issue that seems kind of strange to me

Solution 1:

You have it the wrong way round, you encrypt with the public key, and decrypt with the private key.

The publicly available encrypting-key is widely distributed, while the private decrypting-key is known only to the recipient. Messages are encrypted with the recipient's public key and can be decrypted only with the corresponding private key. Source

The idea is that you give the sending side the public key (which anyone can have, so you can distribute it in the open) then you encrypt the data with it, then decrypt it on your end with your private key (which only you have). This way the data stays secure.

You can encrypt something with the private key as the private key contains the information required to make the public key, but it would be unusual to do so, as normally the person encrypting the data does not have the private key.

Post a Comment for "Pycrypto: Decrypt Only With Public Key In File (no Private+public Key)"