If I have a message M and a public key P, and I encrypt them alongside one another:

CIPHER = AES(M + P, aes_key)

Is CIPHER now weakened if someone knows what P is? It seems like if I encrypted only P:

CIPHER = AES(P, aes_key)

that it should be possible to recover aes_key from CIPHER. I realize that this is different than encrypting M + P, but is a weakness introduced?

My goal is to be able to send a signed encrypted message without revealing the originator publicly.

  • 5
    $\begingroup$ AES is secure against known-plaintext attacks, though I suggest not using ECB mode in the case you're going to encrypt M+P. Using CBC or CTR modes seem to be OK. $\endgroup$ – M.S. Dousti Aug 24 '11 at 1:15
  • $\begingroup$ @Sadeq: Why not post this as an answer? $\endgroup$ – Paŭlo Ebermann Aug 24 '11 at 1:18
  • 1
    $\begingroup$ @Sadeq: Thanks, just what I needed to know. Not complaining, but I am curious: why not post this comment as an answer so I can accept it? $\endgroup$ – shino Aug 24 '11 at 1:20
  • $\begingroup$ @Paŭlo, shino: Thanks a lot for the appreciation. I thought it was too short to be made an answer, thus I left it as comment. Moreover, Marsh Ray's answer complements mine, and is long enough ;) $\endgroup$ – M.S. Dousti Aug 24 '11 at 13:00

Probably not in this case, although not for the reason you gave.

As @Sadeq points out in the comments, AES is resistant to known-plaintext attacks. This means that by simply knowing M+P or P (the entire plaintext you've encrypted) it should not be possible to recover the AES key.

However, key recovery isn't the only attack and it raises a deeper question: authentication.

This design which sends the signer's public key along with the message seems to imply that the recipient doesn't already know what key the message should be signed by.

If the recipient doesn't know exactly what key the message should be signed by in advance, then he probably shouldn't just accept any random public key for the signature. Even when the AES key is negotiated perfectly securely, the CBC and CTR modes suggested by @sadeq can allow an active attacker to manipulate the decrypted plaintext in well-controlled ways. An attacker could possibly anticipate the signing key and replace it with his own, or selectively corrupt bits of it and observe the recipient's timing and behavior to identify the actual signing key.

It also raises the important question of how the AES key was negotiated securely. How do the sender and recipient know they're not talking to a man-in-the-middle? Maybe you've already addressed that somehow, I don't know.

Of course, there are systems which enable one to securely accept a new public key. For example, if it is signed by a trusted third-party like a certificate authority. But these systems are usually not optimized for anonymity and they raise additional complications for your goal. Address issues of key enrollment, revocation, expiration, etc. from the beginning.

As usual, the strong authentication problem is the harder one here. Solve the authentication and then come back and think about the encryption. It will be much easier to identify and prevent the active attacks that way.

| improve this answer | |

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.