Is there a way to do anonymous encryption to a recipient's Public key, where the only way to open a message would be to decrypt with your own private key + passphrase?


You can write one very easily, but luckily there are libraries for these like Sealed boxes

From the site;

Sealed boxes are designed to anonymously send messages to a recipient given its public key.

Only the recipient can decrypt these messages, using its private key. While the recipient can verify the integrity of the message, it cannot verify the identity of the sender.

A message is encrypted using an ephemeral key pair, whose secret part is destroyed right after the encryption process.

Without knowing the secret key used for a given message, the sender cannot decrypt its own message later. And without additional data, a message cannot be correlated with the identity of its sender. Note: the emphasis is mine.

The sealed boxes based on Crypto boxes that uses

  • Key exchange: X25519
  • Encryption: XSalsa20 stream cipher
  • Authentication: Poly1305 MAC

Keep in mind that the additional data can be, your IP address, your MAC address, your writing style, etc. This may leak your identity or location. You may need some protections/countermeasures like TOR network against the identification of the sender.

  • $\begingroup$ Excellent answer, thanks! $\endgroup$ – Makach Dec 2 at 11:39
  • 1
    $\begingroup$ because It uses Poly1305 bases authentication mechanism, it is a MAC $\endgroup$ – kelalaka Dec 2 at 11:42
  • 1
    $\begingroup$ If I understand correctly, despite "the recipient can verify the integrity of the message", an adversary can still replace the encrypted message by one that successfully pass verification and deciphers to anything that the adversary chooses, but can't make the altered deciphered message meaningfully dependent on the original plaintext. E.g. knowing that the message starts in Meeting at 16h, password is but not knowing the password, the adversary CAN change the message to Meeting at 14h, password is foobar , but CANT make the deciphered message contain the true password; which is good. $\endgroup$ – fgrieu Dec 2 at 12:48
  • 1
    $\begingroup$ @fgrieu Yes, If the adversaries have the power to stop the sent message then the can write a new one as theirs aim. $\endgroup$ – kelalaka Dec 2 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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