| 1 |
<pre>Network Working Group J. Myers |
| 2 |
Request For Comments: 1864 Carnegie Mellon |
| 3 |
Obsoletes: <a href="./rfc1544">1544</a> M. Rose |
| 4 |
Dover Beach Consulting, Inc. |
| 5 |
October 1995 |
| 6 |
|
| 7 |
|
| 8 |
<span class="h1">The Content-MD5 Header Field</span> |
| 9 |
|
| 10 |
Status of this Memo |
| 11 |
|
| 12 |
This document specifies an Internet standards track protocol for the |
| 13 |
Internet community, and requests discussion and suggestions for |
| 14 |
improvements. Please refer to the current edition of the "Internet |
| 15 |
Official Protocol Standards" (STD 1) for the standardization state |
| 16 |
and status of this protocol. Distribution of this memo is unlimited. |
| 17 |
|
| 18 |
Abstract |
| 19 |
|
| 20 |
This memo specifies an optional header field, Content-MD5, for use |
| 21 |
with MIME-conformant messages. |
| 22 |
|
| 23 |
Table of Contents |
| 24 |
|
| 25 |
<a href="#section-1">1</a>. Introduction .............................................. <a href="#page-1">1</a> |
| 26 |
<a href="#section-2">2</a>. Generation of the Content-MD5 Field ....................... <a href="#page-2">2</a> |
| 27 |
<a href="#section-3">3</a>. Processing the Content-MD5 field .......................... <a href="#page-3">3</a> |
| 28 |
<a href="#section-4">4</a>. Security Considerations ................................... <a href="#page-3">3</a> |
| 29 |
<a href="#section-5">5</a>. Acknowledgements .......................................... <a href="#page-3">3</a> |
| 30 |
<a href="#section-6">6</a>. References ................................................ <a href="#page-3">3</a> |
| 31 |
<a href="#section-7">7</a>. Authors' Addresses ........................................ <a href="#page-4">4</a> |
| 32 |
|
| 33 |
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span> |
| 34 |
|
| 35 |
Despite all of the mechanisms provided by MIME [<a href="#ref-1" title=""MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies"">1</a>] which attempt to |
| 36 |
protect data from being damaged in the course of email transport, it |
| 37 |
is still desirable to have a mechanism for verifying that the data, |
| 38 |
once decoded, are intact. For this reason, this memo defines the use |
| 39 |
of an optional header field, Content-MD5, which may be used as a |
| 40 |
message integrity check (MIC), to verify that the decoded data are |
| 41 |
the same data that were initially sent. The Content-MD5 header may |
| 42 |
also be placed in the encapsulated headers of an object of type |
| 43 |
message/external-body, to be used to verify that the retreived and |
| 44 |
decoded data are the same data that were initially referenced. |
| 45 |
|
| 46 |
MD5 is an algorithm for computing a 128 bit "digest" of arbitrary- |
| 47 |
length data, with a high degree of confidence that any alterations in |
| 48 |
the data will be reflected in alterations in the digest. The MD5 |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<span class="grey">Myers & Rose Standards Track [Page 1]</span></pre> |
| 53 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span> |
| 54 |
<span class="grey"><a href="./rfc1864">RFC 1864</a> Content-MD5 Header Field October 1995</span> |
| 55 |
|
| 56 |
|
| 57 |
algorithm itself is defined in [<a href="#ref-2" title=""The MD5 Message-Digest Algorithm"">2</a>]. This memo specifies how the |
| 58 |
algorithm may be used as an integrity check for MIME mail. |
| 59 |
|
| 60 |
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Generation of the Content-MD5 Field</span> |
| 61 |
|
| 62 |
The Content-MD5 field is generated by only an originating user agent. |
| 63 |
Message relays and gateways are expressly forbidden from generating a |
| 64 |
Content-MD5 field. |
| 65 |
|
| 66 |
Use of the Content-MD5 field is completely optional, but its use is |
| 67 |
recommended whenever data integrity is desired, but Privacy-Enhanced |
| 68 |
Mail services [<a href="#ref-3" title=""Privacy Enhancement for Internet Electronic Mail, Part I: Message Encryption and Authentication Procedures"">3</a>] are not available. (Consult <a href="#section-4">Section 4</a> for further |
| 69 |
details.) The Content-MD5 field may only be added to MIME entities of |
| 70 |
a `leaf' nature, i.e., the Content-MD5 field may be used with any |
| 71 |
content type other than multipart or message/rfc822. |
| 72 |
|
| 73 |
To generate the value of the Content-MD5 field, the MD5 algorithm is |
| 74 |
computed on the canonical form of the MIME entity's object. In |
| 75 |
particular, this means that the sender applies the MD5 algorithm on |
| 76 |
the data immediately after conversion to canonical form, before |
| 77 |
applying any content-transfer-encoding, and that the receiver also |
| 78 |
applies the MD5 algorithm on the canonical form, after undoing any |
| 79 |
content-transfer-encoding. For textual data, this means the MD5 |
| 80 |
algorithm must be computed on data in which the canonical form for |
| 81 |
newlines applies, that is, in which each newline is represented by a |
| 82 |
CR-LF pair. The canonical encoding model of MIME is described in |
| 83 |
<a href="#appendix-G">Appendix G</a> of [<a href="#ref-1" title=""MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies"">1</a>]. |
| 84 |
|
| 85 |
The output of the MD5 algorithm is a 128 bit digest. When viewed in |
| 86 |
network byte order (big-endian order), this yields a sequence of 16 |
| 87 |
octets of binary data. These 16 octets are then encoded according to |
| 88 |
the base64 algorithm in order to obtain the value that is placed in |
| 89 |
the Content-MD5 field. Thus, if the application of the MD5 algorithm |
| 90 |
over the raw data of a MIME entity results in a digest having the |
| 91 |
(unlikely) value of "Check Integrity!", then that MIME entity's |
| 92 |
header could contain the field |
| 93 |
|
| 94 |
Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ== |
| 95 |
|
| 96 |
Finally, as discussed in <a href="#appendix-B">Appendix B</a> of [<a href="#ref-1" title=""MIME (Multipurpose Internet Mail Extensions) Part One: Mechanisms for Specifying and Describing the Format of Internet Message Bodies"">1</a>], textual data is regularly |
| 97 |
altered in the normal delivery of mail. Because the addition or |
| 98 |
deletion of trailing white space will result in a different digest, |
| 99 |
either the quoted-printable or base64 algorithm should be employed as |
| 100 |
a content-transfer-encoding when the Content-MD5 field is used. |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
<span class="grey">Myers & Rose Standards Track [Page 2]</span></pre> |
| 109 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span> |
| 110 |
<span class="grey"><a href="./rfc1864">RFC 1864</a> Content-MD5 Header Field October 1995</span> |
| 111 |
|
| 112 |
|
| 113 |
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Processing the Content-MD5 field</span> |
| 114 |
|
| 115 |
If the Content-MD5 field is present, a recipient user agent may |
| 116 |
choose to use it to verify that the contents of a MIME entity have |
| 117 |
not been modified during transport. Message relays and gateways are |
| 118 |
expressly forbidden to alter their processing based on the presence |
| 119 |
of the Content-MD5 field. However, a message gateway is allowed to |
| 120 |
remove the Content-MD5 field if the corresponding MIME entity is |
| 121 |
translated into a different content-type. |
| 122 |
|
| 123 |
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Security Considerations</span> |
| 124 |
|
| 125 |
This document specifies a data integrity service that protects data |
| 126 |
from accidental modification while in transit from the sender to the |
| 127 |
recipient. A secure data integrity service, such as that provided by |
| 128 |
Privacy Enhanced Mail [<a href="#ref-3" title=""Privacy Enhancement for Internet Electronic Mail, Part I: Message Encryption and Authentication Procedures"">3</a>], is conjectured to protect data from all |
| 129 |
modifications. |
| 130 |
|
| 131 |
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Acknowledgements</span> |
| 132 |
|
| 133 |
This memo is based almost entirely on text originally written by |
| 134 |
Nathaniel Borenstein of Bellcore. In addition, several improvements |
| 135 |
were suggested by Keith Moore of the University of Tennessee, |
| 136 |
Knoxville. |
| 137 |
|
| 138 |
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. References</span> |
| 139 |
|
| 140 |
[<a id="ref-1">1</a>] Borenstein, N., and N. Freed, "MIME (Multipurpose Internet Mail |
| 141 |
Extensions) Part One: Mechanisms for Specifying and Describing |
| 142 |
the Format of Internet Message Bodies", <a href="./rfc1521">RFC 1521</a>, Bellcore, |
| 143 |
Innosoft, September 1993. |
| 144 |
|
| 145 |
[<a id="ref-2">2</a>] Rivest, R., "The MD5 Message-Digest Algorithm", <a href="./rfc1321">RFC 1321</a>, MIT |
| 146 |
Laboratory for Computer Science and RSA Data Security, Inc., |
| 147 |
April 1992. |
| 148 |
|
| 149 |
[<a id="ref-3">3</a>] Linn, J., "Privacy Enhancement for Internet Electronic Mail, Part |
| 150 |
I: Message Encryption and Authentication Procedures", <a href="./rfc1421">RFC 1421</a>, |
| 151 |
IAB IRTF PSRG, IETF PEM WG, February 1993. |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
<span class="grey">Myers & Rose Standards Track [Page 3]</span></pre> |
| 165 |
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span> |
| 166 |
<span class="grey"><a href="./rfc1864">RFC 1864</a> Content-MD5 Header Field October 1995</span> |
| 167 |
|
| 168 |
|
| 169 |
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Authors' Addresses</span> |
| 170 |
|
| 171 |
John G. Myers |
| 172 |
Carnegie Mellon University |
| 173 |
|
| 174 |
EMail: [email protected] |
| 175 |
|
| 176 |
|
| 177 |
Marshall T. Rose |
| 178 |
Dover Beach Consulting, Inc. |
| 179 |
|
| 180 |
EMail: [email protected] |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
Myers & Rose Standards Track [Page 4] |
| 221 |
</pre> |