# Is there a way to do anonymous encryption to a recipient?

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.

• Excellent answer, thanks! – Makach Dec 2 at 11:39
• because It uses Poly1305 bases authentication mechanism, it is a MAC – kelalaka Dec 2 at 11:42
• 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. – fgrieu Dec 2 at 12:48
• @fgrieu Yes, If the adversaries have the power to stop the sent message then the can write a new one as theirs aim. – kelalaka Dec 2 at 13:04