One document matched: draft-jones-json-web-encryption-00.xml


<?xml version="1.0" encoding="US-ASCII"?>
<?xml-stylesheet type='text/xsl' href='http://xml.resource.org/authoring/rfc2629.xslt' ?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC1421 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1421.xml">
<!ENTITY RFC1952 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.1952.xml">
<!ENTITY RFC2119 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC3275 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3275.xml">
<!ENTITY RFC3394 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3394.xml">
<!ENTITY RFC3447 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3447.xml">
<!ENTITY RFC3629 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3629.xml">
<!ENTITY RFC3986 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3986.xml">
<!ENTITY RFC4086 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4086.xml">
<!ENTITY RFC4627 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4627.xml">
<!ENTITY RFC4648 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4648.xml">
<!ENTITY RFC5226 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5226.xml">
<!ENTITY RFC5280 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5280.xml">
<!ENTITY RFC5652 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5652.xml">
<!ENTITY RFC5785 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5785.xml">
<!ENTITY RFC6090 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6090.xml">
<!ENTITY W3C.REC-xmlenc-core-20021210 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.REC-xmlenc-core-20021210.xml">
<!ENTITY W3C.CR-xmlenc-core1-20110303 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.CR-xmlenc-core1-20110303.xml">
<!ENTITY jsms PUBLIC "" "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.draft-rescorla-jsms-00.xml">

]>
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-jones-json-web-encryption-00"
     ipr="trust200902">
  <front>
    <title abbrev="JWE">JSON Web Encryption (JWE)</title>

    <author fullname="Michael B. Jones" initials="M.B." surname="Jones">
      <organization>Microsoft</organization>
      <address>
        <email>mbj@microsoft.com</email>
        <uri>http://self-issued.info/</uri>
      </address>
    </author>

    <author fullname="Eric Rescorla" initials="E." surname="Rescorla">
      <organization>RTFM, Inc.</organization>
      <address>
        <email>ekr@rtfm.com</email>
      </address>
    </author>

    <author fullname="Joe Hildebrand" initials="J." surname="Hildebrand">
      <organization>Cisco Systems, Inc.</organization>
      <address>
        <email>jhildebr@cisco.com</email>
      </address>
    </author>

    <date day="6" month="September" year="2011" />

    <area>Security</area>

    <keyword>RFC</keyword>
    <keyword>Request for Comments</keyword>
    <keyword>I-D</keyword>
    <keyword>Internet-Draft</keyword>
    <keyword>Assertion</keyword>
    <keyword>Simple Web Token</keyword>
    <keyword>Security Token</keyword>
    <keyword>SWT</keyword>
    <keyword>JavaScript Object Notation</keyword>
    <keyword>JSON</keyword>
    <keyword>JSON Web Token</keyword>
    <keyword>JWT</keyword>
    <keyword>JSON Web Signature</keyword>
    <keyword>JWS</keyword>
    <keyword>JSON Web Encryption</keyword>
    <keyword>JWE</keyword>
    <keyword>JSON Web Key</keyword>
    <keyword>JWK</keyword>

    <abstract>
      <t>
	TBD - THIS SPECIFICATION IS CURRENTLY UNDER DEVELOPMENT AND INCOMPLETE
      </t>
      <t>
	JSON Web Encryption (JWE) is a means of representing encrypted
	content using JSON data structures.  Related signature
	capabilities are described in the separate JSON Web Signature
	(JWS) specification.
      </t>
    </abstract>

    <note title="Requirements Language">
      <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">RFC 2119</xref>.
      </t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>
	TBD - THIS SPECIFICATION IS CURRENTLY UNDER DEVELOPMENT AND INCOMPLETE
      </t>
      <t>
	JSON Web Encryption (JWE) is a compact encryption format
	intended for space constrained environments such as HTTP
	Authorization headers and URI query parameters.  It provides a
	wrapper for encrypted content using JSON <xref
	target="RFC4627">RFC 4627</xref> data structures.  The JWE
	encryption mechanisms are independent of the type of content
	being encrypted.  A related signature capability is described
	in a separate JSON Web Signature (JWS) <xref target="JWS" />
	specification.
      </t>
    </section>

    <section title="Terminology">
      <t>
	<list style="hanging">

          <t hangText="JSON Web Encryption (JWE)">
	    A data structure representing an encrypted version of a
	    Plaintext.  The structure consists of three parts: the JWE
	    Header, the JWE Encrypted Key, and the JWE Ciphertext.
	  </t>

	  <t hangText="Plaintext">
	    The bytes to be encrypted - a.k.a., the message.
	  </t>

	  <t hangText="Ciphertext">
	    The encrypted version of the Plaintext.
	  </t>

	  <t hangText="Content Encryption Key (CEK)">
	    A symmetric key generated to encrypt the Plaintext for the
	    recipient to produce the Ciphertext, which is encrypted to
	    the recipient as the JWE Encrypted Key.
	  </t>

          <t hangText="JWE Header">
	    A string containing a JSON object that describes the
	    encryption operations applied to create the JWE Encrypted
	    Key and the JWE Ciphertext.
	  </t>
          <t hangText="JWE Ciphertext">
	    A byte array containing the Ciphertext.
	  </t>
          <t hangText="JWE Encrypted Key">
	    The Content Encryption Key (CEK) is encrypted with the
	    intended recipient's key and the resulting encrypted
	    content is recorded as a byte array, which is referred to
	    as the JWE Encrypted Key.
	  </t>

          <t hangText="Encoded JWE Header">
	    Base64url encoding of the UTF-8 <xref target="RFC3629">RFC
	    3629</xref> representation of the JWE Header.
	  </t>

          <t hangText="Encoded JWE Ciphertext">
	    Base64url encoding of the JWE Ciphertext.
	  </t>
          <t hangText="Encoded JWE Encrypted Key">
	    Base64url encoding of the JWE Encrypted Key.
	  </t>

	  <t hangText="Header Parameter Names">
	    The names of the members within the JWE Header.
	  </t>
	  <t hangText="Header Parameter Values">
	    The values of the members within the JWE Header.
	  </t>

          <t hangText="Base64url Encoding">
	    For the purposes of this specification, this term always
	    refers to the URL- and filename-safe Base64 encoding
	    described in <xref target="RFC4648">RFC 4648</xref>,
	    Section 5, with the '=' padding characters omitted, as
	    permitted by Section 3.2.  (See Appendix C of <xref
	    target="JWS" /> for notes on implementing base64url
	    encoding without padding.)
	  </t>
        </list>
      </t>
    </section>

    <section title="JSON Web Encryption (JWE) Overview">

      <t>
	TBD - THIS SPECIFICATION IS CURRENTLY UNDER DEVELOPMENT AND INCOMPLETE
      </t>
      <t>
	JWE provides a wrapper for encrypted content using JSON data
	structures and base64url encoding.  The representation
	consists of three parts: the JWT Header, the JWE Encrypted
	Key, and the JWE Ciphertext.  The three parts are
	base64url-encoded for transmission, and typically represented
	as the concatenation of the encoded strings in that order,
	with the three strings being separated by period ('.')
	characters, as is done when used in JSON Web Tokens (JWTs)
	<xref target="JWT" />.
      </t>
      <t>
	JWE utilizes encryption to ensure the confidentiality of the
	contents of the Plaintext.  JWE does not add a content
	integrity check if not provided by the underlying encryption
	algorithm.  If such a check is needed, an algorithm providing
	it such as AES-GCM <xref target="NIST-800-38D" /> can be used,
	or alternatively, it can be provided through composition by
	encrypting a representation of the signed content.
      </t>

      <section title="Example JWE" anchor="ExampleJWE">

	<t>
	  The following example JWE Header object declares that:
	  <list style="symbols">
	    <t>
	      the Content Encryption Key is encrypted to the recipient
	      using the RSA-PKCS1_1.5 algorithm to produce the JWE
	      Encrypted Key,
	    </t>
	    <t>
	      the Plaintext is encrypted using the AES-256-GCM
	      algorithm to produce the JWE Ciphertext,
	    </t>
	    <t>
	      the specified 64-bit Initialization Vector with the
	      based64url encoding <spanx
	      style="verb">__79_Pv6-fg</spanx> was used,
	    </t>
	    <t>
	      the thumbprint of the X.509 certificate that corresponds
	      to the key used to encrypt the JWE has the base64url
	      encoding <spanx
	      style="verb">7noOPq-hJ1_hCnvWh6IeYI2w9Q0</spanx>.
	    </t>
	  </list>
	</t>

	<artwork><![CDATA[{"alg":"RSA1_5",
 "enc":"A256GCM",
 "iv":"__79_Pv6-fg",
 "x5t":"7noOPq-hJ1_hCnvWh6IeYI2w9Q0"}]]></artwork>

	<t>
	  Base64url encoding the UTF-8 representation of the JWE
	  Header yields this Encoded JWE Header value:
	</t>

	<artwork><![CDATA[TBD]]></artwork>

	<t>
	  TBD finish this example by showing generation of a Content
	  Encryption Key (CEK), using the CEK to encrypt the Plaintext
	  to produce the Ciphertext (and base64url encoding it), and
	  using the recipient's key to encrypt the CEK to produce the
	  JWE Encrypted Key (and base64url encoding it).
	</t>

      </section>
    </section>

    <section title="JWE Header">

      <t>
	The members of the JWE Header describe the encryption applied
	to the Plaintext.  Implementations MUST understand the
	entire contents of the header; otherwise, the JWE MUST be
	rejected for processing.
      </t>
      <t>
	The member names within the JWE Header are referred to as
	Header Parameter Names.  These names MUST be unique.  The
	corresponding values are referred to as Header Parameter
	Values.
      </t>

      <section title="Reserved Header Parameter Names" anchor="ReservedHeaderParameterName">
	<t>
	  The following header parameter names are reserved.  All the
	  names are short because a core goal of JWE is for the
	  representations to be compact.
	</t>
	<t>
	  TBD Describe the relationship between the JWS and JWE header
	  parameters - especially the <spanx style="verb">alg</spanx>
	  parameter, which can contain either signature algorithms
	  (from JWS) or encryption algorithms (from JWE), and the key
	  reference parameters <spanx style="verb">jku</spanx>, <spanx
	  style="verb">kid</spanx>, <spanx style="verb">x5u</spanx>,
	  and <spanx style="verb">x5t</spanx>.
	</t>

	<texttable title="Reserved Header Parameter Definitions" anchor="HeaderParameterTable">

	  <ttcol align="left">Header Parameter Name</ttcol>
	  <ttcol align="left">JSON Value Type</ttcol>
	  <ttcol align="left">Header Parameter Syntax</ttcol>
	  <ttcol align="left">Header Parameter Semantics</ttcol>

	  <c>alg</c>
	  <c>string</c>
	  <c>StringOrURI</c>
	  <c>
	    The <spanx style="verb">alg</spanx> (algorithm) header
	    parameter identifies the cryptographic algorithm used to
	    secure the JWE Encrypted Key.  A list of reserved <spanx
	    style="verb">alg</spanx> values is presented in <xref
	    target="AlgTable"></xref>.
	    The processing of the <spanx style="verb">alg</spanx>
	    (algorithm) header parameter requires that the value of
	    the <spanx style="verb">alg</spanx> header parameter MUST
	    be one that is both supported and for which there exists a
	    key for use with that algorithm associated with the
	    intended recipient.  The <spanx style="verb">alg</spanx>
	    value is case sensitive.
	    This header parameter is REQUIRED.
	  </c>

	  <c>enc</c>
	  <c>string</c>
	  <c>StringOrURI</c>
	  <c>
	    The <spanx style="verb">enc</spanx> (encryption
	    method) header parameter identifies the symmetric
	    encryption algorithm used to secure the Ciphertext.  A
	    list of reserved <spanx style="verb">enc</spanx> values is
	    presented in <xref target="EncTable"></xref>.  The
	    processing of the <spanx style="verb">enc</spanx>
	    (encryption method) header parameter requires that the
	    value of the <spanx style="verb">enc</spanx> header
	    parameter MUST be one that is supported.  The <spanx
	    style="verb">enc</spanx> value is case sensitive.  This
	    header parameter is REQUIRED.
	  </c>

	  <c>iv</c>
	  <c>string</c>
	  <c>String</c>
	  <c>
	    Initialization Vector (<spanx style="verb">iv</spanx>)
	    value for algorithms requiring it, represented as a
	    base64url encoded string.
	    This header parameter is OPTIONAL.
	  </c>

	  <c>epk</c>
	  <c>string</c>
	  <c>String</c>
	  <c>
	    Ephemeral Public Key (<spanx style="verb">epk</spanx>)
	    value created by the originator for the use in ECDH-ES
	    <xref target="RFC6090">RFC 6090</xref>
	    encryption.  This key is represented in the same manner as
	    a JSON Web Key <xref target="JWK" /> JWK Key Object value,
	    containing <spanx style="verb">curve</spanx>, <spanx
	    style="verb">x</spanx>, and <spanx style="verb">y</spanx>
	    members.  The inclusion of the JWK Key Object <spanx
	    style="verb">algorithm</spanx> member is OPTIONAL.
	    This header parameter is OPTIONAL.
	  </c>

	  <c>zip</c>
	  <c>string</c>
	  <c>String</c>
	  <c>
	    Compression algorithm (<spanx style="verb">zip</spanx>)
	    applied to the Plaintext before encryption, if any.  This
	    specification defines the value <spanx
	    style="verb">GZIP</spanx> to refer to the <xref
	    target="RFC1952">GZIP</xref> algorithm.  If no <spanx
	    style="verb">zip</spanx> parameter is present, or its
	    value is <spanx style="verb">none</spanx>, no compression
	    is applied to the Plaintext before encryption.  The <spanx
	    style="verb">zip</spanx> value is case sensitive.  This
	    header parameter is OPTIONAL.
	  </c>

	  <c>jku</c>
	  <c>string</c>
	  <c>URL</c>
	  <c>
	    The <spanx style="verb">jku</spanx> (JSON Key URL) header
	    parameter is a URL that points to a JSON-encoded set of
	    public keys, one of which corresponds to the key that was
	    used to encrypt the JWE.  The keys MUST
	    be encoded as per the JSON Web Key (JWK) <xref
	    target="JWK" /> specification.  This header parameter is
	    OPTIONAL.
	  </c>

	  <c>kid</c>
	  <c>string</c>
	  <c>String</c>
	  <c>
	    The <spanx style="verb">kid</spanx> (key ID) header
	    parameter is a hint indicating which key was used to
	    encrypt the JWE.  This
	    allows originators to explicitly signal a change of key to
	    recipients.  Omitting this parameter is equivalent to
	    setting it to an empty string.  The interpretation of the
	    contents of the <spanx style="verb">kid</spanx> parameter
	    is unspecified.
	    This header parameter is OPTIONAL.
	  </c>

	  <c>x5u</c>
	  <c>string</c>
	  <c>URL</c>
	  <c>
	    The <spanx style="verb">x5u</spanx> (X.509 URL) header
	    parameter is a URL utilizing TLS (as defined in <xref
	    target="RFC5785">RFC 5785</xref>) that points to an X.509
	    public key certificate or certificate chain that that
	    corresponds to the key that was used to encrypt the JWE.
	    This certificate or
	    certificate chain MUST use the PEM encoding (per <xref
	    target="RFC1421">RFC 1421</xref>) and MUST conform to <xref
	    target="RFC5280">RFC 5280</xref>.
	    This header parameter is OPTIONAL.
	  </c>

	  <c>x5t</c>
	  <c>string</c>
	  <c>String</c>
	  <c>
	    The <spanx style="verb">x5t</spanx> (x.509 certificate
	    thumbprint) header parameter provides a base64url encoded
	    SHA-1 thumbprint (a.k.a. digest) of the DER encoding of
	    the X.509 certificate that corresponds to the key that was
	    used to encrypt the JWE.
	    This header parameter is OPTIONAL.
	  </c>

	  <c>typ</c>
	  <c>string</c>
	  <c>String</c>
	  <c>
	    The <spanx style="verb">typ</spanx> (type) header
	    parameter is used to declare the type of the encrypted
	    content.
	    The <spanx style="verb">typ</spanx> value is case sensitive.
	    This header parameter is OPTIONAL.
	  </c>

	</texttable>

	<t>
	  Additional reserved header parameter names MAY be defined
	  via the IANA JSON Web Encryption Header Parameters registry,
	  as per <xref target="IANA" />.  The syntax values used above
	  are defined as follows:
	</t>

	<texttable title="Header Parameter Syntax Definitions" anchor="SyntaxDefinitions">
	  <ttcol align="left">Syntax Name</ttcol>
	  <ttcol align="left">Syntax Definition</ttcol>

	  <c>String</c>
	  <c>
	    Any string value MAY be used.
	  </c>

	  <c>StringOrURI</c>
	  <c>
	    Any string value MAY be used but a value containing a ":"
	    character MUST be a URI as defined in <xref
	    target="RFC3986">RFC 3986</xref>.
	  </c>

	</texttable>

      </section>

      <section title="Public Header Parameter Names" anchor="PublicHeaderParameterName">

        <t>
	  Additional header parameter names can be defined by those
	  using JWE. However, in order to prevent collisions, any new
	  header parameter name or algorithm value SHOULD either be
	  defined in the IANA JSON Web Encryption Header Parameters
	  registry or be defined as a URI that contains a collision
	  resistant namespace.  In each case, the definer of the name
	  or value MUST take reasonable precautions to make sure they
	  are in control of the part of the namespace they use to
	  define the header parameter name.
	</t>
	<t>
	  New header parameters should be introduced sparingly, as
	  they can result in non-interoperable JWEs.
	</t>
      </section>

      <section title="Private Header Parameter Names" anchor="PrivateHeaderParameterName">

	<t>
	  A producer and consumer of a JWE may agree to any header
	  parameter name that is not a Reserved Name <xref
	  target="ReservedHeaderParameterName"></xref> or a Public
	  Name <xref
	  target="PublicHeaderParameterName"></xref>. Unlike Public
	  Names, these private names are subject to collision and
	  should be used with caution.
	</t>
	<t>
	  New header parameters should be introduced sparingly, as
	  they can result in non-interoperable JWEs.
	</t>

      </section>
    </section>

    <section anchor="sec.encryption" title="Message Encryption">
      <t>The message encryption process is as follows:</t>

      <t><list style="numbers">
	  <t>
	    Generate a random Content Encryption Key (CEK). The CEK
	    MUST have a length at least equal to that of the required
	    encryption keys and MUST be generated randomly.  See <xref
	    target="RFC4086">RFC 4086</xref> for considerations on
	    generating random values.
	  </t>
	  <t>
	    Encrypt the CEK for the recipient (see <xref
	    target="sec.encrypt_cek"/>).
	  </t>
	  <t>
	    Generate a random IV (if required for the algorithm).
	  </t>
	  <t>
	    Compress the Plaintext if a <spanx
	    style="verb">zip</spanx> parameter was included.
	  </t>
	  <t>
	    Serialize the (compressed) Plaintext into a bitstring M.
	  </t>
	  <t>
	    Encrypt M using the CEK and IV to form the bitstring C.
	  </t>
	  <t>
	    Set the Encoded JWE Ciphertext equal to the base64url encoded
	    representation of C.
	  </t>
	  <t>
	    Create the JWE Header containing the encryption
	    parameters used.
	  </t>
	  <t>
	    Base64url encoded the UTF-8 representation of the JWE
	    Header to create the Encoded JWE Header.
	  </t>
	  <t>
	    The three encoded parts, taken together, are the result of
	    the encryption.
	  </t>
	</list></t>
    </section>

    <section anchor="sec.decryption" title="Message Decryption">
      <t>The message decryption process is the reverse of the encryption
      process.  If any of these steps fails, the JWE MUST be rejected.</t>

      <t>
	<list style="numbers">
	  <t>
	    The Encoded JWE Header, the Encoded JWE Encrypted Key, and
	    the Encoded JWE Ciphertext MUST successfully base64url
	    decoded following the restriction that no padding
	    characters have been used.
	  </t>
          <t>
	    The resulting JWE Header MUST be completely valid
	    JSON syntax conforming to <xref target="RFC4627">RFC
	    4627</xref>.
	  </t>
          <t>
	    The resulting JWE Header MUST be validated to only include
	    parameters and values whose syntax and semantics are both
	    understood and supported.
	  </t>
	  <t>
	    Verify that the JWE Header appears to reference a key
	    known to the recipient.
	  </t>
	  <t>
	    Decrypt the JWE Encrypted Key to produce the CEK.
	  </t>
	  <t>
	    Decrypt the binary representation of the JWE Ciphertext
	    using the CEK.
	  </t>
	  <t>
	    Uncompress the result of the previous step, if a <spanx
	    style="verb">zip</spanx> parameter was included.
	  </t>
	  <t>
	    Output the result.
	  </t>
	</list>
      </t>
    </section>

    <section anchor="sec.encrypt_cek" title="CEK Encryption">
      <t>
	JWE supports two forms of CEK encryption:
      </t>
      <t>
	<list style="symbols">
	  <t>
	    Asymmetric encryption under the recipient's public key.
	  </t>
	  <t>
	    Symmetric encryption under a shared key.
	  </t>
	</list>
      </t>

      <section anchor="sec.asymmetric_encryption"
	       title="Asymmetric Encryption">
	<t>
	  In the asymmetric encryption mode, the CEK is encrypted
	  under the recipient's public key. The asymmetric encryption
	  modes defined for use with this in this specification are
	  listed in in <xref target="AlgTable"></xref>.
	</t>
      </section>

      <section anchor="sec.symmetric_encryption"
	       title="Symmetric Encryption">
	<t>
	  In the symmetric encryption mode, the CEK is encrypted under
	  a symmetric key shared between the sender and receiver.
	  <!-- All such modes MUST provide integrity for the CEK. -->
	  The symmetric encryption modes defined for use with this in
	  this specification are listed in in <xref target="AlgTable"></xref>.
	  For GCM, the random 64-bit IV is prepended to the ciphertext.
	</t>
      </section>
    </section>

    <section anchor="sec.msg-composition" title="Composition">
      <t>
	This document does not specify a combination signed and
	encrypted mode. However, because the contents of a message can
	be arbitrary, and encryption and data origin authentication
	can be provided by recursively encapsulating multiple JWE and
	JWS messages. In general, senders SHOULD sign the message and
	then encrypt the result (thus encrypting the signature). This
	prevents attacks in which the signature is stripped, leaving
	just an encrypted message, as well as providing privacy for
	the signer.
      </t>
    </section>

    <section title="Encrypting JWEs with Cryptographic Algorithms" anchor="Encrypting">

      <t>
	JWE uses cryptographic algorithms to encrypt the Content
	Encryption Key (CEK) and the Plaintext.  This section
	specifies a set of specific algorithms for these purposes.
      </t>
      <t>
	The table below <xref target="AlgTable" /> is the set of
	<spanx style="verb">alg</spanx> header parameter values that
	are reserved by this specification.  These algorithms are used
	to encrypt the CEK, which produces the JWE Encrypted Key.
      </t>

      <texttable title="JWE Reserved alg Parameter Values" anchor="AlgTable">

	<ttcol align="left">alg Parameter Value</ttcol>
	<ttcol align="left">Encryption Algorithm</ttcol>

	<c>RSA1_5</c>
	<c>RSA using RSA-PKCS1-1.5 padding, as defined in <xref
	target="RFC3447">RFC 3447</xref></c>

	<c>RSA-OAEP</c>
	<c>RSA using Optimal Asymmetric Encryption Padding (OAEP), as
	defined in <xref target="RFC3447">RFC 3447</xref></c>

	<c>ECDH-ES</c>
	<c>Elliptic Curve Diffie-Hellman Ephemeral Secret, as defined
	in <xref target="RFC6090">RFC 6090</xref>, and using the
	Concat KDF, as defined in <xref target="NIST-800-56A" /></c>

	<c>A128KW</c>
	<c>Advanced Encryption Standard (AES) Key Wrap Algorithm using
	128 bit keys, as defined in <xref target="RFC3394">RFC
	3394</xref></c>

	<c>A256KW</c>
	<c>Advanced Encryption Standard (AES) Key Wrap Algorithm using
	256 bit keys, as defined in <xref target="RFC3394">RFC
	3394</xref></c>

	<c>A128GCM</c>
	<c>Advanced Encryption Standard (AES) using 128 bit keys in
	Galois/Counter Mode, as defined in <xref target="FIPS-197" />
	and <xref target="NIST-800-38D" /></c>

	<c>A256GCM</c>
	<c>Advanced Encryption Standard (AES) using 256 bit keys in
	Galois/Counter Mode, as defined in <xref target="FIPS-197" />
	and <xref target="NIST-800-38D" /></c>

      </texttable>

      <t>
	The table below <xref target="EncTable" /> is the set of
	<spanx style="verb">enc</spanx> header parameter values that
	are reserved by this specification.  These algorithms are used
	to encrypt the Plaintext, which produces the Ciphertext.
      </t>

      <texttable title="JWE Reserved enc Parameter Values" anchor="EncTable">

	<ttcol align="left">enc Parameter Value</ttcol>
	<ttcol align="left">Symmetric Encryption Algorithm</ttcol>

	<c>A128CBC</c>
	<c>Advanced Encryption Standard (AES) using 128 bit keys in
	Cipher Block Chaining mode, as defined in <xref target="FIPS-197" />
	and <xref target="NIST-800-38A" /></c>

	<c>A256CBC</c>
	<c>Advanced Encryption Standard (AES) using 256 bit keys in
	Cipher Block Chaining mode, as defined in <xref target="FIPS-197" />
	and <xref target="NIST-800-38A" /></c>

	<c>A128GCM</c>
	<c>Advanced Encryption Standard (AES) using 128 bit keys in
	Galois/Counter Mode, as defined in <xref target="FIPS-197" />
	and <xref target="NIST-800-38D" /></c>

	<c>A256GCM</c>
	<c>Advanced Encryption Standard (AES) using 256 bit keys in
	Galois/Counter Mode, as defined in <xref target="FIPS-197" />
	and <xref target="NIST-800-38D" /></c>

      </texttable>

      <t>
	Of these algorithms, only RSA-PKCS1-1.5 with 2048 bit keys,
	AES-128-CBC, and AES-256-CBC MUST be implemented by conforming
	implementations.  It is RECOMMENDED that implementations also
	support ECDH-ES with 256 bit keys, AES-128-GCM, and
	AES-256-GCM.  Support for other algorithms and key sizes is
	OPTIONAL.
      </t>

      <section title="Encrypting a JWE with TBD" anchor="EncryptingWithTBD">

	<t>
	  TBD - Descriptions of the particulars of each specified
	  algorithm go here
	</t>

      </section>

      <section title="Additional Algorithms" anchor="MoreAlgs">

	<t>
	  Additional algorithms MAY be used to protect JWEs with
	  corresponding <spanx style="verb">alg</spanx> and <spanx
	  style="verb">enc</spanx> header parameter values being
	  defined to refer to them. New <spanx
	  style="verb">alg</spanx> and <spanx style="verb">enc</spanx>
	  header parameter values SHOULD either be defined in the IANA
	  JSON Web Encryption Algorithms registry or be a URI that
	  contains a collision resistant namespace.  In particular,
	  the use of algorithm identifiers defined in <xref
	  target="W3C.REC-xmlenc-core-20021210" />, <xref
	  target="W3C.CR-xmlenc-core1-20110303" />, and related
	  specifications is permitted.
	</t>

      </section>
    </section>

    <section title="IANA Considerations" anchor="IANA">
      <t>
	This specification calls for:

        <list style="symbols">

          <t>
	    A new IANA registry entitled "JSON Web Encryption Header
	    Parameters" for reserved header parameter names is defined
	    in <xref target="ReservedHeaderParameterName"></xref>.
	    Inclusion in the registry is RFC Required in the <xref
	    target="RFC5226">RFC 5226</xref> sense for reserved JWE
	    header parameter names that are intended to be
	    interoperable between implementations.  The registry will
	    just record the reserved header parameter name and a
	    pointer to the RFC that defines it. This specification
	    defines inclusion of the header parameter names defined in
	    <xref target="HeaderParameterTable"></xref>.
	  </t>
          <t>
	    A new IANA registry entitled "JSON Web Encryption
	    Algorithms" for reserved values used with the <spanx
	    style="verb">alg</spanx> and <spanx
	    style="verb">enc</spanx> header parameter values, as
	    defined in <xref target="MoreAlgs"></xref>. Inclusion in
	    the registry is RFC Required in the <xref
	    target="RFC5226">RFC 5226</xref> sense. The registry will
	    record the <spanx style="verb">alg</spanx> or <spanx
	    style="verb">enc</spanx> value and a pointer to the RFC
	    that defines it.  This specification defines inclusion of
	    the algorithm values defined in <xref
	    target="AlgTable"></xref> and <xref
	    target="EncTable"></xref>.
	  </t>
        </list>
      </t>
    </section>

    <section title="Security Considerations" anchor="Security">
      <t>
	TBD: Lots of work to do here. We need to remember to look into
	any issues relating to security and JSON parsing. One wonders
	just how secure most JSON parsing libraries are. Were they
	ever hardened for security scenarios? If not, what kind of
	holes does that open up? Also, we need to walk through the
	JSON standard and see what kind of issues we have especially
	around comparison of names.  For instance, comparisons of
	header parameter names and other parameters must occur after
	they are unescaped. Need to also put in text about: Importance
	of keeping secrets secret. Rotating keys. Strengths and
	weaknesses of the different algorithms.
      </t>
      <t>
	TBD: Need to put in text about why strict JSON validation is
	necessary.  Basically, that if malformed JSON is received then
	the intent of the sender is impossible to reliably discern.
      </t>
      <t>
	[[ TBD: we need a section on generating randomness in browsers
	- it's easy to screw up ]]
      </t>

      <section title="Unicode Comparison Security Issues">

        <t>
	  Header parameter names in JWEs are Unicode strings.  For
	  security reasons, the representations of these names must be
	  compared verbatim after performing any escape processing (as
	  per <xref target="RFC4627">RFC 4627</xref>, Section 2.5).
	</t>
        <t>
	  This means, for instance, that these JSON strings must
	  compare as being equal ("enc", "\u0065nc"), whereas these
	  must all compare as being not equal to the first set or to
	  each other ("ENC", "Enc", "en\u0043").
	</t>
	<t>
	  JSON strings MAY contain characters outside the Unicode
	  Basic Multilingual Plane.  For instance, the G clef
	  character (U+1D11E) may be represented in a JSON string as
	  "\uD834\uDD1E".  Ideally, JWE implementations SHOULD ensure
	  that characters outside the Basic Multilingual Plane are
	  preserved and compared correctly; alternatively, if this is
	  not possible due to these characters exercising limitations
	  present in the underlying JSON implementation, then input
	  containing them MUST be rejected.
	</t>

      </section>
    </section>

    <section title="Open Issues and Things To Be Done (TBD)" anchor="TBD">

      <t>
	The following items remain to be done in this draft (and related drafts):

	<list style="symbols">

	  <t>
	    Describe the relationship between the JWE, JWS, and JWT
	    header parameters.  In particular, point out that the set of
	    "alg" values defined by each must be compatible and
	    non-overlapping.
	  </t>
	  <t>
	    Consider whether we want to define composite
	    signing/encryption operations (as was the consensus to do
	    at IIW, as documented at http://self-issued.info/?p=378).
	  </t>
	  <t>
	    Consider whether reusing the JWS <spanx
	    style="verb">jku</spanx>, <spanx style="verb">kid</spanx>,
	    <spanx style="verb">x5u</spanx>, and <spanx
	    style="verb">x5t</spanx> parameters is the right thing to
	    do, particularly as it effectively precludes specifying
	    composite operations.
	  </t>
	  <t>
	    Consider whether to add parameters for directly including
	    keys in the header, either as JWK Key Objects, or X.509
	    cert values, or both.
	  </t>
	  <t>
	    Consider whether to add version numbers.
	  </t>
	  <t>
	    Consider which of the open issues from the JWS and JWT specs
	    also apply here.
	  </t>
	  <t>
	    Finish the Security Considerations section.
	  </t>
	  <t>
	    Write a note in the Security Considerations section about
	    how <spanx style="verb">x5t</spanx> (x.509 certificate
	    thumbprint) should be deprecated because of known problems
	    with SHA-1.
	  </t>
	  <t>
	    Should StringOrURI use IRIs rather than RFC 3986 URIs?
	  </t>
	  <t>
	    Provide a more robust description of the use of the IV.
	    The current statement "For GCM, the random 64-bit IV is
	    prepended to the ciphertext" in the Symmetric Encryption
	    section is almost certainly out of place.
	  </t>
	  <t>
	    It would be good to say somewhere, in normative language,
	    that eventually the algorithms and/or key sizes currently
	    specified will no longer be considered sufficiently secure
	    and will be removed.  Therefore, implementers MUST be
	    prepared for this eventuality.
	  </t>
	</list>
      </t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      &RFC1421;
      &RFC1952;
      &RFC2119;
      &RFC3447;
      &RFC3629;
      &RFC3986;
      &RFC4086;
      &RFC4627;
      &RFC4648;
      &RFC5226;
      &RFC5280;
      &RFC5785;
      &RFC6090;

      <reference anchor="FIPS-197">
        <front>
          <title>Advanced Encryption Standard (AES)</title>
          <author>
            <organization>National Institute of Standards and Technology (NIST)
            </organization>
          </author>
          <date month="November" year="2001" />
        </front>
        <seriesInfo name="FIPS" value="PUB 197" />
      </reference>

      <reference anchor="NIST-800-38A">
        <front>
          <title>Recommendation for Block Cipher Modes of Operation</title>
          <author>
            <organization>National Institute of Standards and Technology (NIST)
            </organization>
          </author>
          <date month="December" year="2001" />
        </front>
        <seriesInfo name="NIST" value="PUB 800-38A" />
      </reference>

      <reference anchor="NIST-800-38D">
        <front>
          <title>Recommendation for Block Cipher Modes of Operation:
	  Galois/Counter Mode (GCM) and GMAC</title>
          <author>
            <organization>National Institute of Standards and Technology (NIST)
            </organization>
          </author>
          <date month="December" year="2001" />
        </front>
        <seriesInfo name="NIST" value="PUB 800-38D" />
      </reference>

      <reference anchor="NIST-800-56A">
        <front>
          <title>Recommendation for Pair-Wise Key Establishment Schemes Using Discrete Logarithm Cryptography (Revised)</title>
          <author>
            <organization>National Institute of Standards and Technology (NIST)
            </organization>
          </author>
          <date month="March" year="2007" />
        </front>
        <seriesInfo name="NIST" value="PUB 800-56A" />
      </reference>

      <reference anchor="JWT">
        <front>
          <title>JSON Web Token (JWT)</title>

	  <author fullname="Michael B. Jones" initials="M.B." surname="Jones">
	    <organization>Microsoft</organization>
	    <address>
	      <email>mbj@microsoft.com</email>
	      <uri>http://self-issued.info/</uri>
	    </address>
	  </author>

	  <author fullname="Dirk Balfanz" initials="D." surname="Balfanz">
	    <organization>Google</organization>
	    <address>
	      <email>balfanz@google.com</email>
	    </address>
	  </author>

	  <author fullname="John Bradley" initials="J." surname="Bradley">
	    <organization>independent</organization>
	    <address>
	      <email>ve7jtb@ve7jtb.com</email>
	    </address>
	  </author>

	  <author fullname="Yaron Y. Goland" initials="Y.Y." surname="Goland">
	    <organization>Microsoft</organization>
	    <address>
	      <email>yarong@microsoft.com</email>
	    </address>
	  </author>

	  <author fullname="John Panzer" initials="J." surname="Panzer">
	    <organization>Google</organization>
	    <address>
	      <email>jpanzer@google.com</email>
	    </address>
	  </author>

	  <author fullname="Nat Sakimura" initials="N." surname="Sakimura">
	    <organization>Nomura Research Institute</organization>
	    <address>
	      <email>n-sakimura@nri.co.jp</email>
	    </address>
	  </author>

	  <author fullname="Paul Tarjan" initials="P." surname="Tarjan">
	    <organization>Facebook</organization>
	    <address>
	      <email>pt@fb.com</email>
	    </address>
	  </author>

	  <date day="11" month="July" year="2011" />
        </front>
        <format target="http://self-issued.info/docs/draft-jones-json-web-token.html" type="HTML" />
      </reference>

      <reference anchor="JWS">
        <front>
          <title>JSON Web Signature (JWS)</title>

	  <author fullname="Michael B. Jones" initials="M.B." surname="Jones">
	    <organization>Microsoft</organization>
	    <address>
	      <email>mbj@microsoft.com</email>
	      <uri>http://self-issued.info/</uri>
	    </address>
	  </author>

	  <author fullname="Dirk Balfanz" initials="D." surname="Balfanz">
	    <organization>Google</organization>
	    <address>
	      <email>balfanz@google.com</email>
	    </address>
	  </author>

	  <author fullname="John Bradley" initials="J." surname="Bradley">
	    <organization>independent</organization>
	    <address>
	      <email>ve7jtb@ve7jtb.com</email>
	    </address>
	  </author>

	  <author fullname="Yaron Y. Goland" initials="Y.Y." surname="Goland">
	    <organization>Microsoft</organization>
	    <address>
	      <email>yarong@microsoft.com</email>
	    </address>
	  </author>

	  <author fullname="John Panzer" initials="J." surname="Panzer">
	    <organization>Google</organization>
	    <address>
	      <email>jpanzer@google.com</email>
	    </address>
	  </author>

	  <author fullname="Nat Sakimura" initials="N." surname="Sakimura">
	    <organization>Nomura Research Institute</organization>
	    <address>
	      <email>n-sakimura@nri.co.jp</email>
	    </address>
	  </author>

	  <author fullname="Paul Tarjan" initials="P." surname="Tarjan">
	    <organization>Facebook</organization>
	    <address>
	      <email>pt@fb.com</email>
	    </address>
	  </author>

	  <date day="29" month="April" year="2011" />
        </front>
        <format target="http://self-issued.info/docs/draft-jones-json-web-signature.html" type="HTML" />
      </reference>

      <reference anchor="JWK">
        <front>
	  <title>JSON Web Key (JWK)</title>

	  <author fullname="Michael B. Jones" initials="M.B." surname="Jones">
	    <organization>Microsoft</organization>
	    <address>
	      <email>mbj@microsoft.com</email>
	      <uri>http://self-issued.info/</uri>
	    </address>
	  </author>

	  <date day="29" month="April" year="2011" />
        </front>
        <format target="http://self-issued.info/docs/draft-jones-json-web-key.html" type="HTML" />
      </reference>

    </references>

    <references title="Informative References">
      &RFC3275;
      &RFC3394;
      &RFC5652;
      &W3C.REC-xmlenc-core-20021210;
      &W3C.CR-xmlenc-core1-20110303;

      &jsms;

      <reference anchor="JSS">
        <front>
          <title>JSON Simple Sign</title>

	  <author fullname="John Bradley" initials="J." surname="Bradley">
	    <organization>independent</organization>
	  </author>

	  <author fullname="Nat Sakimura (editor)" initials="N. " surname="Sakimura (editor)">
	    <organization>Nomura Research Institute</organization>
	  </author>

          <date month="September" year="2010" />
        </front>
        <format target="http://jsonenc.info/jss/1.0/" type="HTML" />
      </reference>

      <reference anchor="JCA">
        <front>
          <title>Java Cryptography Architecture</title>

	  <author fullname="Oracle" surname="Oracle">
	  </author>

          <date year="2011" />
        </front>
        <format target="http://download.java.net/jdk7/docs/technotes/guides/security/SunProviders.html" type="HTML" />
      </reference>

    </references>

    <section title="JWE Examples" anchor="JWEExamples">

      <t>
	This section provides several examples of JWEs.
      </t>

      <section title="JWE Example using TBD Algorithm" anchor="TBDExample">
	<section title="Encrypting">
	  <t>
	    TBD Demonstrate encryption steps with this algorithm
	  </t>
	</section>
	<section title="Decrypting">
	  <t>
	    TBD Demonstrate decryption steps with this algorithm
	  </t>
	</section>
      </section>

    </section>

    <section title="Algorithm Identifier Cross-Reference" anchor="algxref">
      <t>
	This appendix contains a table cross-referencing the <spanx
	style="verb">alg</spanx> and <spanx style="verb">enc</spanx>
	values used in this specification with the equivalent
	identifiers used by other standards and software packages.
	See <xref target="RFC3275">XML DSIG</xref> and <xref
	target="JCA">Java Cryptography Architecture</xref> for more
	information about the names defined by those documents.

      </t>
      <texttable title="Algorithm Identifier Cross-Reference" anchor="algxreftable">

	<ttcol align="left">Algorithm</ttcol>
	<ttcol align="left">JWE</ttcol>
	<ttcol align="left">XML ENC</ttcol>
	<ttcol align="left">JCA</ttcol>
	<ttcol align="left">OID</ttcol>

	<c>RSA using RSA-PKCS1-1.5 padding</c>
	<c>RSA1_5</c>
	<c>http://www.w3.org/2001/04/xmlenc#rsa-1_5</c>
	<c>RSA/ECB/PKCS1Padding</c>
	<!-- TBD RSA/None/PKCS1Padding or RSA/ECB/PKCS1Padding ? -->
	<c>TBD</c>

	<c>RSA using Optimal Asymmetric Encryption Padding (OAEP)</c>
	<c>RSA-OAEP</c>
	<c>http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p</c>
	<c>RSA/ECB/OAEPWithSHA-1AndMGF1Padding</c>
	<!-- RSA/ECB/OAEPWithSHA-1AndMGF1Padding or RSA/ECB/OAEPWithSHA-256AndMGF1Padding or RSA/NONE/OAEPWithSHA-1AndMGF1Padding or RSA/NONE/OAEPWithSHA-256AndMGF1Padding ? -->
	<c>TBD</c>

	<c>Elliptic Curve Diffie-Hellman Ephemeral Secret</c>
	<c>ECDH-ES</c>
	<c>http://www.w3.org/2009/xmlenc11#ECDH-ES</c>
	<c>TBD</c>
	<c>TBD</c>

	<c>Advanced Encryption Standard (AES) Key Wrap Algorithm <xref
	target="RFC3394">RFC 3394</xref> using 128 bit keys</c>
	<c>A128KW</c>
	<c>http://www.w3.org/2001/04/xmlenc#kw-aes128</c>
	<c>TBD</c>
	<c>TBD</c>

	<c>Advanced Encryption Standard (AES) Key Wrap Algorithm <xref
	target="RFC3394">RFC 3394</xref> using 256 bit keys</c>
	<c>A256KW</c>
	<c>http://www.w3.org/2001/04/xmlenc#kw-aes256</c>
	<c>TBD</c>
	<c>TBD</c>

	<c>Advanced Encryption Standard (AES) using 128 bit keys in
	Cipher Block Chaining mode</c>
	<c>A128CBC</c>
	<c>http://www.w3.org/2001/04/xmlenc#aes128-cbc</c>
	<c>AES/CBC/PKCS5Padding</c>
	<c>TBD</c>

	<c>Advanced Encryption Standard (AES) using 256 bit keys in
	Cipher Block Chaining mode</c>
	<c>A256CBC</c>
	<c>http://www.w3.org/2001/04/xmlenc#aes256-cbc</c>
	<c>AES/CBC/PKCS5Padding</c>
	<c>TBD</c>

	<c>Advanced Encryption Standard (AES) using 128 bit keys in
	Galois/Counter Mode</c>
	<c>A128GCM</c>
	<c>http://www.w3.org/2009/xmlenc11#aes128-gcm</c>
	<c>AES/GCM/NoPadding</c>
	<c>TBD</c>

	<c>Advanced Encryption Standard (AES) using 256 bit keys in
	Galois/Counter Mode</c>
	<c>A256GCM</c>
	<c>http://www.w3.org/2009/xmlenc11#aes256-gcm</c>
	<c>AES/GCM/NoPadding</c>
	<c>TBD</c>

      </texttable>
    </section>

    <section title="Acknowledgements" anchor="Acknowledgements">

      <t>
	Solutions for encrypting JSON content were also explored by
	<xref target="JSS" /> and <xref target="I-D.rescorla-jsms"/>,
	both of which significantly influenced this draft.  This draft
	attempts to explicitly reuse as much from <xref
	target="W3C.CR-xmlenc-core1-20110303" /> and <xref
	target="RFC5652">RFC 5652</xref> as possible, while utilizing
	simple compact JSON-based data structures.
      </t>
      <t>
	Special thanks are due to John Bradley and Nat Sakimura for
	the discussions that helped inform the content of this
	specification and to Eric Rescorla and Joe Hildebrand for
	allowing the reuse of some of the text from <xref
	target="I-D.rescorla-jsms"/> in this document.
      </t>

    </section>

    <section title='Document History'>
      <t>
        -00
        <list style='symbols'>
          <t>
            First encryption draft based upon consensus decisions at
            IIW documented at http://self-issued.info/?p=378.  The
            ability to provide encryption for JSON Web Tokens (JWTs)
            <xref target="JWT" /> is a primary use case.
          </t>
        </list>
      </t>
    </section>     

  </back>
</rfc>

PAFTECH AB 2003-20262026-04-24 02:19:56