Show that CPA-security implies security against plaintext recovery Consider the following experiment:


$k = Gen(1^n)$
$m \stackrel{u}{\in} \{0,1\}^{l(n)}$  
$c = Enc_k(m)$
$m' = B(1^n,c)$


Define the winning event as $m' = m$. I would like to show that if the encryption scheme $Enc$ is CPA-secure thn every PPT-algorithm $B$ can only succeed with negligible probability in the above experiment.

Proposal

This is the solution I have come up myself with:
Your solution is almost correct. Just don't forget to consider the following two cases: 1) $m_0$ and $m_1$ may be the same, then $A$ will have to guess the secret bit $b$ blindly; 2) $B$ may return the other message, e.g., $B$ happens to return $m_1$ when given $E_k(m_0)$, then $A$'s output will be wrong. Note that 1) and 2) occur with only negligible probabilities.