I am implementing a bit of security in a system that was originally built without encryption on a specific piece of data. The plan was to encrypt this piece of data and include it as part of the response in a web service. But this data is plainly available in the front end so the user could easily see the plain value and its encrypted value. How hard is it to derive the key and iv? I think it would be too easy to be comfortable with. Am I right? Is there any security worth doing if they can always see the plain value?

  • 3
    $\begingroup$ Generally, known-plaintext attacks on AES are assumed to be hard. However, it is not at all clear to my what you're trying to achieve — what is the attack you want to defend against? (That is, please clarify your last sentence: What do you mean by "security"? Just blindly throwing in some encryption here and there does not magically improve any kind of security.) $\endgroup$
    – yyyyyyy
    Mar 20, 2015 at 12:26
  • $\begingroup$ I'm not defending against any particular attack, per sé, it would just be a layered defense strategy to not disclose any data that is not needed to be known by the user. Eventually we would protect the front end as well, but I think it could do more harm than good to only protect the data sometimes. It is difficult for me to get specific because I could describe something that would prompt our network security team to bust me. $\endgroup$
    – Crowcoder
    Mar 20, 2015 at 12:53
  • $\begingroup$ Is the decryption happening on your box? $\endgroup$
    – cpast
    Mar 20, 2015 at 14:21
  • $\begingroup$ Yes, server side. $\endgroup$
    – Crowcoder
    Mar 20, 2015 at 14:47
  • 3
    $\begingroup$ Security decisions should never be made without the proper knowledge. Things like that lead to all those little pieces of negative publicity, because someone botched something trivial royally. $\endgroup$
    – tylo
    Mar 20, 2015 at 17:59

1 Answer 1


Are you using CBC mode? AES-CBC is supposed to be secure against known-plaintext attack, as long as you are using different random IVS with different messages. The encryption key would remain a secret even if the attacker knows the IV, plain text, and the encrypted message.


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