gpg - Is the MDC check redundant if the file is signed?

5

I understand that gpg 1.4.9 computes a MDC code by default. According to my research this corresponds to to Sym. Encrypted and Integrity Protected Data Packet (tag 18) in the PGP spec. If the file is signed doesn't this also provide modification protection (in addition to providing proof of sender's identity)?

I think this might be the case because I wrote code using the BouncyCastle API and and noticed that when one verified a signed file, a signature is computed from the encrypted data stream and compared against the one recorded in the file.

I'm trying to understand whether there is some redundancy here or if these two mechanisms serve different purposes.

Shane Mcpherson

Posted 2011-12-22T05:36:51.827

Reputation: 271

Answers

2

Yes, all versions of GPG signatures provide modification protection. When you sign a document, it creates a hash of the document (which algorithm it uses depends on the preferences you have set). The hash is then encoded using your private key. Anybody can use your public key to decode the hash, assuring them that you are the one who sent the message. In addition, they know that the message has not been altered in the time after you signed it.

In addition, when encrypting a document, whether you sign it or not, an MDC hash is created. This is to provide modification protection in case the document is not signed. The RFC 4880 gives an explanation of why this may be useful:

The obvious way to protect or authenticate an encrypted block is to digitally sign it. However, many people do not wish to habitually sign data, for a large number of reasons beyond the scope of this document. Suffice it to say that many people consider properties such as deniability to be as valuable as integrity.

It seems that if you both encrypt and sign a message, then you have redundancy, although the signature gives you more information, assuring you about the identity of the sender in addition to the integrity of the message.

Nathan Grigg

Posted 2011-12-22T05:36:51.827

Reputation: 1 601

Thanks - this helps. What I am also trying to figure out is the purpose of the MDC which seems to be computed even if the file is not signed. – Shane Mcpherson – 2012-01-16T10:42:04.393

Edited, now that I understand better what you want to know. – Nathan Grigg – 2012-01-16T15:25:48.417

Thanks, exactly what I was looking for. Sorry it took so long for me to get around to accepting your answer, this question slipped my mind for a while. – Shane Mcpherson – 2012-02-18T04:48:57.897