I read a book called "computer networking: A top-down approach". It talked about how PGP creates an email message between Alice and Bob to maintain confidentiality, integrity, and authenticity. Let me define some terminology and the procedure at the very high level:
m : email message
H() : cryptographic hash function
Ka_priv_sign() : signing using Alice's private key
|| : contacternation
Ks : session key
Ks_enc(): encryption using session key
Kb_pub_enc(): encryption using bob's public key
blob : The final data blob Alice sends to Bob.
To send an email to Bob, Alice first signs the message with her private key:
m || Ka_priv_sign(H(m))
Alice then encrypt the message and signature
blob = Kb_pub_enc(Ks) || Ks_enc(m || Ka_priv_sign(H(m)))
Alice will send this final blob to Bob.
The cryptography seems to have a problem here since digital signature is applied before encryption and encryption does not provide data integrity. I think the right order of operation should be:
Alice first encrypts the message with the session key and encrypt the session key with Bob's public key:
Kb_pub_enc(Ks) || Ks_enc(m)
Alice then signs the encryption results after hashing them:
blob' = Kb_pub_enc(Ks) || Ks_enc(m) || Ka_priv_sign(H(Kb_pub_enc(Ks) || Ks_enc(m))))
Questions:
Is PGP still using the way that the textbook describes today? Do you think my construction is better?