7Network Working Group J. Myers
8Request For Comments: 1864 Carnegie Mellon
10 Dover Beach Consulting, Inc.
14 The Content-MD5 Header Field
18 This document specifies an Internet standards track protocol for the
19 Internet community, and requests discussion and suggestions for
20 improvements. Please refer to the current edition of the "Internet
21 Official Protocol Standards" (STD 1) for the standardization state
22 and status of this protocol. Distribution of this memo is unlimited.
26 This memo specifies an optional header field, Content-MD5, for use
27 with MIME-conformant messages.
31 1. Introduction .............................................. 1
32 2. Generation of the Content-MD5 Field ....................... 2
33 3. Processing the Content-MD5 field .......................... 3
34 4. Security Considerations ................................... 3
35 5. Acknowledgements .......................................... 3
36 6. References ................................................ 3
37 7. Authors' Addresses ........................................ 4
41 Despite all of the mechanisms provided by MIME [1] which attempt to
42 protect data from being damaged in the course of email transport, it
43 is still desirable to have a mechanism for verifying that the data,
44 once decoded, are intact. For this reason, this memo defines the use
45 of an optional header field, Content-MD5, which may be used as a
46 message integrity check (MIC), to verify that the decoded data are
47 the same data that were initially sent. The Content-MD5 header may
48 also be placed in the encapsulated headers of an object of type
49 message/external-body, to be used to verify that the retreived and
50 decoded data are the same data that were initially referenced.
52 MD5 is an algorithm for computing a 128 bit "digest" of arbitrary-
53 length data, with a high degree of confidence that any alterations in
54 the data will be reflected in alterations in the digest. The MD5
58Myers & Rose Standards Track [Page 1]
60RFC 1864 Content-MD5 Header Field October 1995
63 algorithm itself is defined in [2]. This memo specifies how the
64 algorithm may be used as an integrity check for MIME mail.
662. Generation of the Content-MD5 Field
68 The Content-MD5 field is generated by only an originating user agent.
69 Message relays and gateways are expressly forbidden from generating a
72 Use of the Content-MD5 field is completely optional, but its use is
73 recommended whenever data integrity is desired, but Privacy-Enhanced
74 Mail services [3] are not available. (Consult Section 4 for further
75 details.) The Content-MD5 field may only be added to MIME entities of
76 a `leaf' nature, i.e., the Content-MD5 field may be used with any
77 content type other than multipart or message/rfc822.
79 To generate the value of the Content-MD5 field, the MD5 algorithm is
80 computed on the canonical form of the MIME entity's object. In
81 particular, this means that the sender applies the MD5 algorithm on
82 the data immediately after conversion to canonical form, before
83 applying any content-transfer-encoding, and that the receiver also
84 applies the MD5 algorithm on the canonical form, after undoing any
85 content-transfer-encoding. For textual data, this means the MD5
86 algorithm must be computed on data in which the canonical form for
87 newlines applies, that is, in which each newline is represented by a
88 CR-LF pair. The canonical encoding model of MIME is described in
91 The output of the MD5 algorithm is a 128 bit digest. When viewed in
92 network byte order (big-endian order), this yields a sequence of 16
93 octets of binary data. These 16 octets are then encoded according to
94 the base64 algorithm in order to obtain the value that is placed in
95 the Content-MD5 field. Thus, if the application of the MD5 algorithm
96 over the raw data of a MIME entity results in a digest having the
97 (unlikely) value of "Check Integrity!", then that MIME entity's
98 header could contain the field
100 Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ==
102 Finally, as discussed in Appendix B of [1], textual data is regularly
103 altered in the normal delivery of mail. Because the addition or
104 deletion of trailing white space will result in a different digest,
105 either the quoted-printable or base64 algorithm should be employed as
106 a content-transfer-encoding when the Content-MD5 field is used.
114Myers & Rose Standards Track [Page 2]
116RFC 1864 Content-MD5 Header Field October 1995
1193. Processing the Content-MD5 field
121 If the Content-MD5 field is present, a recipient user agent may
122 choose to use it to verify that the contents of a MIME entity have
123 not been modified during transport. Message relays and gateways are
124 expressly forbidden to alter their processing based on the presence
125 of the Content-MD5 field. However, a message gateway is allowed to
126 remove the Content-MD5 field if the corresponding MIME entity is
127 translated into a different content-type.
1294. Security Considerations
131 This document specifies a data integrity service that protects data
132 from accidental modification while in transit from the sender to the
133 recipient. A secure data integrity service, such as that provided by
134 Privacy Enhanced Mail [3], is conjectured to protect data from all
139 This memo is based almost entirely on text originally written by
140 Nathaniel Borenstein of Bellcore. In addition, several improvements
141 were suggested by Keith Moore of the University of Tennessee,
146 [1] Borenstein, N., and N. Freed, "MIME (Multipurpose Internet Mail
147 Extensions) Part One: Mechanisms for Specifying and Describing
148 the Format of Internet Message Bodies", RFC 1521, Bellcore,
149 Innosoft, September 1993.
151 [2] Rivest, R., "The MD5 Message-Digest Algorithm", RFC 1321, MIT
152 Laboratory for Computer Science and RSA Data Security, Inc.,
155 [3] Linn, J., "Privacy Enhancement for Internet Electronic Mail, Part
156 I: Message Encryption and Authentication Procedures", RFC 1421,
157 IAB IRTF PSRG, IETF PEM WG, February 1993.
170Myers & Rose Standards Track [Page 3]
172RFC 1864 Content-MD5 Header Field October 1995
178 Carnegie Mellon University
184 Dover Beach Consulting, Inc.
186 EMail: mrose@dbc.mtview.ca.us
226Myers & Rose Standards Track [Page 4]