Elliptic Curve encryption and decryption on Solidity and Python

Viewed 29

I am trying to create a smart contract where I have to encrypt (and decrypt) data that I receive from a Python script running on a client. The data will be encrypted on the client-side, and I will have to decrypt it on the smart contract.

I got a smart contract code which can generate a key pair here. I am new to cryptography, and I tried looking up how I can encrypt plaintext using the public key and decrypt using the private key, but I am not getting a proper answer anywhere.

It will be great if someone can guide me to a relevant resource. Thank you.

1 Answers

Actually, this document does a pretty good job of going through the steps of using one particular Python elliptic curve library.

Note that you don't actually encrypt or decrypt large amounts of data using the public/private key. Instead, one uses ECC to create a shared secret key, and then that shared secret key is used with AES or whatever is your encryption algorithm of choice.

Related