How is the message digest related to Signatures and Encryption? I was studying about 'Data Security' and I found out this one thing confusing.

What is a message digest? I got it is the hash of the message.

Is the message here referring to the plaintext or cipher text? I believe when using Digital Signatures, the message itself is also encrypted with a public key.
First of all, yes, the message digest is the hash of the message.

Secondly, do not mix things up. You are talking about public key encryption and signature. Let's redefine them to make sure we have everything right.

Alice and Bob got pairs of key ($A_{pub}$, $A_{priv}$), ($B_{pub}$, $B_{priv}$). Alice knows $B_{pub}$ and Bob knows $A_{pub}$.


Alice wants to send a message $m$ to Bob $\implies$ She encrypts it with $B_{pub}$.
Alice wants to prove to Bob that it was she who sent the message $\implies$ She signs it with her private key $A_{priv}$.


How does the message digest appear in all that ? Continue reading.



Problem: signing and encryption using RSA (standard procedure) is slow. How to speed up the process ?


Alice encrypts the message with a symmetric cipher (AES) using a random generated key $K_{sym}$. Then, encrypt $K_{sym}$ with the $B_{pub}$.
Alice does not sign the message, she signs the message digest. Smaller therefore faster.




All this together ? Here are the steps :


Alice hashes the message $m$ $\implies$ she gets the message digest.$H(m) \to MD$.
Alice signs $MD$ with her private key.
$E_{A_{priv}}(MD) \to Sig$.
Alice generates a random key for the symmetric encryption.
$rdm() \to K_{sym}$
Alice encrypts the message and the signature with a symmetric cypher.
$E_{K_{sym}}(m\|Sig) \to c$
Alice encrypts the symmetric key with Bob's public key.
$E_{B_{pub}}(K_{Sym}) \to K_{cipher}$
Alice sends $(c,K_{cipher})$ to Bob.




Remark: It is a good practice to have 2 pairs of keys : one for encryption, one for signatures.