I want symmetric encryption algorithms that cannot have their keys recovered when given plaintext and ciphertext. I tried XOR cipher algorithm, but when I've obtained ciphertext and plaintext, the key stream is easily reproduced.

Is there any symmetric encryption algorithm that's safe against key-recovery attack when encryption and decryption value are known?

  • 3
    $\begingroup$ All modern ciphers and mode of operations (e.g. AES-CBC, AES-GCM, ChaCha20-Poly1305) are secure against "key recovery attack" when implemented correctly. $\endgroup$ – DannyNiu Apr 9 '18 at 1:43

Within the modern concept of cryptographic security of symmetric cipher, resistance to key-recovery under CCA and CPA is a must, because for most of modern encrypted communication, plaintext is almost always partially guessable alongside ciphertext.

Here, CCA and CPA are two general attack models (I'm simplifying):

  • CCA: attacker can ask for decryption any ciphertext other than the one he intend to crack.

  • CPA: attacker can ask for the encryption of any plaintext.

In both model, the attacker will try to establish correlation between ciphertext and plaintext to aid further decryption, and one of the methods as you've mentioned - is to simply guess the key.

Modern symmetric ciphers and their mode of operations, such as AES-GCM (RFC 5116 and Official NIST webpage), AES-CBC-HMAC, ChaCha20-Poly1305, are secure enough for your purpose. And in addition, they provides authenticity - communicating parties can be sure the ciphertext didn't come from attacker or anybody else.

Side note, there are mature protocols for encapsulating application communication - such as SSL/TLS - which requires a x509 certificate (which you need to buy), or SSH (secure shell) - which uses a "known_hosts" file to authenticate the server. They've also mature implementations such as LibreSSL and OpenSSH that you can use.


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.