<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC0020 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.0020.xml">
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC3156 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3156.xml">
<!ENTITY RFC4880 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4880.xml">
<!ENTITY RFC5234 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5234.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="yes" ?>
<?rfc comments="no" ?>
<?rfc inline="no" ?>
<?rfc editing="no" ?>
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<rfc
category="std"
docName="draft-bray-pgp-message-00"
ipr="pre5378Trust200902"
>

<front>
<title abbrev="PGP Message">The OpenPGP Message Format</title>

<author fullname="Tim Bray" initials="T." surname="Bray" role="editor">
<organization>Textuality</organization>
<address>
<email>tbray@textuality.com</email>
</address>
</author>

<date year="2014" month="October"/>

<area>Operations and Management</area>

<abstract>

<t>RFC 4880 specifies the encoding for encrypted OpenPGP
messages.  This document registers an Internet Media Type for these
messages.</t>
</abstract>

</front>

<middle>

<section title="Introduction">

<t>The OpenPGP message format, specified in <xref target="RFC4880"/>, is widely supported, with implementations in many programming languages.</t>
<t><xref target="RFC3156"/> specifies the "multipart/encrypted" media type to describe these messages; the "application/pgp-encrypted", "application/pgp-signature", and "application/pgp-keys" media types are specified for use as protocol parameter values and the content type of the MIME body parts.</t>
<t>Currently, there exist popular applications which specialize in the interchange of pure text payloads. These can be used for the transport of OpenPGP messages (perhaps on a copy-and-paste basis), but they typically do not support multipart messages and thus would have difficulty with RFC3156-style packaging. It would be advantageous if these "naked" OpenPGP messages could be labeled with a media type to facilitate dispatch to software which can decrypt them.</t>

<section title="Conventions Used in This Document">

<t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in <xref target="RFC2119" />.</t>

<t>The grammatical rules in this document are to be interpreted as
described in <xref target="RFC5234" />.</t>

</section>
</section>

<section title="OpenPGP Message">

<t>The format of OpenPGP Messages is described in <xref target="RFC4880"/>.  Messages can be encoded in one of two formats: binary (section 11.3) or textual "ASCII-armored" (sections 2.4 and 6).</t>

<t>A single media type serves to identify both, since they are trivially distinguishable.</t>

<t>A binary message is a sequence of "packets", each of which has a header (see section 4 of RFC4880) beginning with a "tag" byte, which must have the high-order bit set.</t>

<t>The syntax of an ASCII-armored message is specified in detail in RFC4880 Section 6.  This specification will not create ABNF to replicate that specification, since it is widely understood and there are many successful software implementations which consume it.  However, it begins with a leading hyphen ("-", U+002D HYPHEN-MINUS).</t>
<t>For flexibiity and better support of copy/paste operation, this specification alows the body of an application/pgp-message to have insignificant white space ("ws" in the production below) surrounding the ASCII-Armored form of the message.  Popular implementations are observed to ignore such white space.</t>

<figure><artwork>
   ws = *(
           %x20 /              ; Space
           %x09 /              ; Horizontal tab
           %x0A /              ; Line feed or New line
           %x0D )              ; Carriage return
</artwork></figure>

<t>Thus, software receiving a message labeled with the application/pgp-message media type can straightforwardly decide how to parse it.  If the high-order bit of the first byte is set, then such software MUST attempt to parse it as a binary OpenPGP message as specified in RFC4880 section 11.3.  Otherwise, if the first byte is a hyphen, or matches the "ws" production above, such software MUST attempt to parse it as an ASCII-Armored OpenPGP message as specified in RFC4880 section 6.  If the first byte meets neither condition, the payload is malformed and no parsing is possible.</t>
</section>

<section title="IANA Considerations" anchor="ianacons">
<t>The MIME media type for an OpenPGP Message is application/pgp-message.

<list style='hanging' hangIndent='3'>
<t hangText='Type name:'>application</t>

<t hangText='Subtype name:'>pgp-message</t>

<t hangText='Required parameters:'>n/a</t>

<t hangText='Optional parameters:'>n/a</t>

<t hangText='Encoding considerations:'>binary</t>
<t hangText='Security considerations:'>This document.</t>
<t hangText='Interoperability considerations:'>Described in this document</t>
<t hangText='Published specification:'>This document</t>

<t hangText='Additional information:'>
Magic number(s): n/a<vspace/>
File extension(s): .asc for ASCII-armored, none for binary<vspace/>
Macintosh file type code(s): TEXT</t>
<t hangText='Person &amp; email address to contact for further information:'>
IESG<vspace/>
&lt;iesg@ietf.org></t>
<t hangText='Intended usage:'> COMMON</t>

<t hangText='Restrictions on usage:'>none</t>

<t hangText='Author:'>
Tim Bray<vspace/>
&lt;tbray@textuality.com></t>
<t hangText='Change controller:'>
IESG<vspace/>
&lt;iesg@ietf.org></t>

</list>
</t>
</section>

<section title="Security Considerations">

<t>The presence of an OpenPGP message serves as notice that the sender (and probably the receiver) have a strong desire to keep its contents private.  It is widely believed that messages encoded using modern cryptography are extremely difficult for an adversary to decrypt. Therefore, adversaries typically focus their attacks on end-point software that may inadvertantly expose either the decryption key or the payload of the message.</t>
<t>It is therefore RECOMMENDED that software which recognizes the application/pgp media type dispatch the encrypted payload as-is to other software which is known to be trusted by the user for purposes of decryption.  It is further RECOMMENDED that software which recognizes the application/pgp-message media type actively try to avoid storing the decrypted form of such messages or the keys used for decryption, and furthermore actively avoid providing the user interface used for interaction with the decryption software.</t>
<t>Implementers should also consult and pay careful attention to the Security Considerations section of RFC4880.</t>
</section>

<section title="Interoperability Considerations">
<t>RFC4880 notes that implementations SHOULD support the ASCII-Armored representation of OpenPGP messages; this format has proven reasonably resiliant to damage during transition over a variety of network channels and, while it occupies more bytes of storage, is often preferred for interchange over general-purpose messaging channels.</t>
</section>

<section anchor="examples" title="Example">

<t>This is an ASCII-Armored OpenPGP Message:</t>

<figure><artwork>-----BEGIN PGP MESSAGE-----
Version: OpenPrivacy 0.99

yDgBO22WxBHv7O8X7O/jygAEzol56iUKiXmV+XmpCtmpqQUKiQrFqclFqUDBovzS
vBSFjNSiVHsuAA==
=njUN
-----END PGP MESSAGE-----</artwork></figure>

</section>

</middle>

<back>

<references title="Normative References">

&RFC2119;
&RFC3156;
&RFC4880;
&RFC5234;

</references>


</back>
</rfc>
