I'm using Python to build a system in which users (accounts on a blockchain: defined by a public key and a secret key) need to communicate with each other securely and I think asymmetric encryption is the way to do it.

For example, if User A wants to send a message to User B, they encrypt the message with User B's public key and sends it to them. User B then uses their private key to decrypt the message and can read it.

However, I don't think it's possible (or I don't know how) to do this sort of encryption with the existing keypair I have for each account. Instead, I think what I should do is use a dedicated asymmetric encryption algorithm and generate the keypairs for that using the original keypair's private key as a seed/source (essentially, deterministically deriving a keypair with which I can do asymmetric encryption from the original private key).

Is this possible? Am I overcomplicating it? What libraries or algorithms should I look into (preferably Python-specific)? Thanks, any help is appreciated!

  • $\begingroup$ Asking for libraries is off-topic here. People might give some suggestions when providing the other answers, but don't count on it. $\endgroup$ Commented Sep 1, 2021 at 21:56
  • $\begingroup$ Ah ok thanks - yeah I should make it clear the question is more about whether it's cryptographically possible/secure and what algorithms I should look at rather than the code (although help on the code is welcome!) $\endgroup$
    – pdemicheli
    Commented Sep 1, 2021 at 22:00

1 Answer 1


You almost certainly can use the the current key-pairs for encryption (e.g., via ECIES or RSA-OAEP). For hybrid cryptography, you're essentially encrypting the message with a symmetric cipher and encrypting that key asymmetrically.

Of course, you can also just generate new key pairs. You can deterministically generate new private keys from the original seed using a key derivation function, or you can just roll completely random keys.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.