0

I have a json data-interchange format where I send messages like the following:

{
  "revision": { "client": "f0ede1da-7314-4e59-99f7-a3a71dcab11f", patch: ["hello world", 0] },
  "client": "f0ede1da-7314-4e59-99f7-a3a71dcab11f",
  "version": 101
}

I want to encrypt the value of revision but I need to send parts of the message unencrypted to ensure causal, once-only delivery of messages.

If I were to encrypt only the revision part of the message so that the result payload looks something like:

{
  "revision": /* CIPHERTEXT */,
  "client": "f0ede1da-7314-4e59-99f7-a3a71dcab11f",
  "version": 101
}

and the client uuids in the unencrypted metadata and encrypted revision matched in almost 90% of cases, would this make the encryption easier to crack?

brainkim
  • 103
  • 2

2 Answers2

4

You are essentially asking if a known plain text makes it easier to decrypt data. Of course a known plain text makes it theoretically possible to try all possible keys for decryption (i.e. brute force attack) and check if the result matches the known expectation. But this is not feasible if the key space is large enough. Apart from that it depends on the exact (but in your case unknown) encryption algorithm, i.e. if this vulnerable to known plaintext attacks or resistant to such attacks.

Apart from that: since you only want to make sure that the combination of "client" and "version" is only used once you could also combine these values and hash the result with SHA-256 or similar. This way you get a unique value for each combination of "client" and "version" but the value is not reversible and thus you don't face the problem that you encrypt data known to some attacker. There is still some known plain text though due to the structure of the message (starts with "{" etc). And even if the encryption algorithm you use is resistant to known plaintext attacks (modern algorithms usually are) it might be worth to hide the "client" and "version" this way.

Soufiane Tahiri
  • 2,667
  • 12
  • 27
Steffen Ullrich
  • 184,332
  • 29
  • 363
  • 424
2

What you're describing is a Known-Plaintext Attack (KPA). All modern ciphers are resistant to it so as long as you use modern cryptography correctly, having part of the plaintext will not help someone decrypt the rest of the cipher text.

user2313067
  • 916
  • 1
  • 6
  • 9
  • Thanks for the answer! I really just needed the Google-able term so I could do more research on this. I accepted Steffen’s answer because it was more comprehensive and came in at roughly the same time. Sorry and thanks again! – brainkim Mar 28 '19 at 08:09
  • 1
    @brainkim a somewhat common way of how known plaintext attacks get exploited is if the encryption system uses a stream cipher (which is common) and somehow manages to reuse the exact same keystream in multiple places. In that case, the effect is something like known-plaintext-A XOR known-ciphertext-A XOR ciphertext-B yields plaintext-B. – Peteris Mar 28 '19 at 10:00