Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

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.

share|improve this question
5  
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. –  Sadeq Dousti Aug 24 '11 at 1:15
    
@Sadeq: Why not post this as an answer? –  Paŭlo Ebermann Aug 24 '11 at 1:18
1  
@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? –  shino Aug 24 '11 at 1:20
    
@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 ;) –  Sadeq Dousti Aug 24 '11 at 13:00
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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