Scenario: Alice and Bob send each other encrypted AES (128) messages. In order to change key, Alice has a public RSA key (2049 bits). Bob has Alice's public key.
Bob picks a random AES key, encrypts it, and sends it to Alice.
Alice decrypts the RSA encryption, if the result is bigger than 2^128
, Alice assumes an error occurred and sends an error message to Bob.
Eve performs a man in the middle attack
.
Eve can change any message and avoid messages to reach their destination.
Eve can't change Bob's and Alice's RSA keys.
How Eve can find the most significant bit
in the AES key that Bob sent?
I got a hint:
let $c = m^e \bmod n$. The decryption of $c\cdot a^e \bmod n$ is $m\cdot a \bmod n$. That's because decryption of $m^e\cdot a^e \bmod n$ is $(m^e \cdot a^e)^d \bmod n$ when $e\cdot d \bmod \varphi(n)=1$.
So I assume Eve can modify Bob's encrypted message $c$ and multiply it with $a^e \bmod n$.
If Alice sent an error message so we can know that $(m\cdot a \bmod n)\ge 2^{128}$.