Score:1

Asymmetric Encryption Using Existing Secret Key

cm flag

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!

Aman Grewal avatar
gb flag
Asking for libraries is off-topic here. People *might* give some suggestions when providing the other answers, but don't count on it.
pdemicheli avatar
cm flag
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!)
Score:1
gb flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.