opencrypto icon indicating copy to clipboard operation
opencrypto copied to clipboard

Encrypt and decryt the public key

Open clauderobi opened this issue 1 year ago • 2 comments

Hi, Super tool for us crypto "challenged"

I would like to protect a public key and therefore was looking for encryptPublicKey and decryptPublicKey but unfortunately they do not exist. My first question is: is it fundamentally a bad thing to do (locking the public key)? The 2nd question: is it mathematically impossible? And, lastly, is it ok to ask for such an enhancement?

clauderobi avatar Aug 26 '22 13:08 clauderobi

Hi,

Can you explain your use case? As the name suggests, Public Key is meant to be Public. It is meant to be shared with the world. In public/private key cryptography, both keys are related to each other in a way that data encrypted with one key can be decrypted with the other key. It is possible to encrypt data with private key & decrypt with with Public key but that is the opposite of how it is meant to be used.

Since Public Key is shared/exposed to the world, it is used to encrypt data and the data is decrypted with the private key (it must be kept private). For added security, A private key is often encrypted with another symmetric key. That symmetric key is often derived from some passphrase like Password.

MacTavish-69 avatar Dec 01 '22 18:12 MacTavish-69

Hi @clauderobi apologies for the wait. I appreciate your interest in OpenCrypto! @Mac000 thank you for answering this thread! I agree with @Mac000 public key doesn't need to be encrypted. @clauderobi would you please describe the real life scenario that you are trying to solve? Maybe we will find a solution together.

PeterBielak avatar Dec 01 '22 18:12 PeterBielak