user6394: If data is encrypted using the public key from a wallet is there a way to decrypt that data using the private key of the wallet? I am essentially looking for the inverse of signData from CIP-0030. I'd like to encrypt a payload using the public key and then allow the user to decrypt it with their private key.

user2335: There is a difference in encryption and signing.

Signing is the act of providing a piece of evidence alongside data that prove that the information is processed with a particular signing key. Given a public corresponding to the singing private key you can check if the data is aproved by that public key.

Encryption is the act of obscuring data to make it not readable. Depending on what type of encryption you use, symmetric vs asymmetric, one can encrypt the data with a private key or public key. Decrypting can only be done with the private key.


Cardano's wallets use an elliptic curve signature scheme (1). Note that this can not encrypt data! It can only create signatures, you can verify signatures onchain with, for example (2). If you want to encrypt some data, you have to use another scheme (like the mentioned El-Gamal encryption scheme).

6394: <p>If data is encrypted using the public key from a wallet is there a way to decrypt that data using the private key of the wallet? I am essentially looking for the inverse of <a href="https://github.com/cardano-foundation/CIPs/tree/master/CIP-0030#apisigndataaddr-address-payload-bytes-promisedatasignature" rel="nofollow noreferrer">signData</a> from CIP-0030. I'd like to encrypt a payload using the public key and then allow the user to decrypt it with their private key.</p>
 2335: <p>There is a difference in encryption and signing.</p>
<ul>
<li><p><strong>Signing</strong> is the act of providing a piece of evidence alongside data that prove that the information is processed with a particular signing key. Given a public corresponding to the singing private key you can check if the data is aproved by that public key.</p>
</li>
<li><p><strong>Encryption</strong> is the act of obscuring data to make it not readable. Depending on what type of encryption you use, symmetric vs asymmetric, one can encrypt the data with a private key or public key. Decrypting can only be done with the private key.</p>
</li>
</ul>
<p>Cardano's wallets use an elliptic curve signature scheme <a href="https://en.wikipedia.org/wiki/Curve25519" rel="nofollow noreferrer">(1)</a>. Note that this can not encrypt data! It can only create signatures, you can verify signatures onchain with, for example <a href="https://playground.plutus.iohkdev.io/doc/haddock/plutus-tx/html/PlutusTx-Builtins-Internal.html#v:verifySignature" rel="nofollow noreferrer">(2)</a>. If you want to encrypt some data, you have to use another scheme (like the mentioned El-Gamal encryption scheme).</p>
