<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en"><head><title>JSON Simple Encryption ver.1 draft00</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="JSON Simple Encryption ver.1 draft00">
<meta name="keywords" content="JSON, Encryption, Draft">
<meta name="generator" content="xml2rfc v1.35 (http://xml.resource.org/)">
<style type='text/css'><!--
        body {
                font-family: verdana, charcoal, helvetica, arial, sans-serif;
                font-size: small; color: #000; background-color: #FFF;
                margin: 2em;
        }
        h1, h2, h3, h4, h5, h6 {
                font-family: helvetica, monaco, "MS Sans Serif", arial, sans-serif;
                font-weight: bold; font-style: normal;
        }
        h1 { color: #900; background-color: transparent; text-align: right; }
        h3 { color: #333; background-color: transparent; }

        td.RFCbug {
                font-size: x-small; text-decoration: none;
                width: 30px; height: 30px; padding-top: 2px;
                text-align: justify; vertical-align: middle;
                background-color: #000;
        }
        td.RFCbug span.RFC {
                font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, verdana, sans-serif;
                font-weight: bold; color: #666;
        }
        td.RFCbug span.hotText {
                font-family: charcoal, monaco, geneva, "MS Sans Serif", helvetica, verdana, sans-serif;
                font-weight: normal; text-align: center; color: #FFF;
        }

        table.TOCbug { width: 30px; height: 15px; }
        td.TOCbug {
                text-align: center; width: 30px; height: 15px;
                color: #FFF; background-color: #900;
        }
        td.TOCbug a {
                font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, sans-serif;
                font-weight: bold; font-size: x-small; text-decoration: none;
                color: #FFF; background-color: transparent;
        }

        td.header {
                font-family: arial, helvetica, sans-serif; font-size: x-small;
                vertical-align: top; width: 33%;
                color: #FFF; background-color: #666;
        }
        td.author { font-weight: bold; font-size: x-small; margin-left: 4em; }
        td.author-text { font-size: x-small; }

        /* info code from SantaKlauss at http://www.madaboutstyle.com/tooltip2.html */
        a.info {
                /* This is the key. */
                position: relative;
                z-index: 24;
                text-decoration: none;
        }
        a.info:hover {
                z-index: 25;
                color: #FFF; background-color: #900;
        }
        a.info span { display: none; }
        a.info:hover span.info {
                /* The span will display just on :hover state. */
                display: block;
                position: absolute;
                font-size: smaller;
                top: 2em; left: -5em; width: 15em;
                padding: 2px; border: 1px solid #333;
                color: #900; background-color: #EEE;
                text-align: left;
        }

        a { font-weight: bold; }
        a:link    { color: #900; background-color: transparent; }
        a:visited { color: #633; background-color: transparent; }
        a:active  { color: #633; background-color: transparent; }

        p { margin-left: 2em; margin-right: 2em; }
        p.copyright { font-size: x-small; }
        p.toc { font-size: small; font-weight: bold; margin-left: 3em; }
        table.toc { margin: 0 0 0 3em; padding: 0; border: 0; vertical-align: text-top; }
        td.toc { font-size: small; font-weight: bold; vertical-align: text-top; }

        ol.text { margin-left: 2em; margin-right: 2em; }
        ul.text { margin-left: 2em; margin-right: 2em; }
        li      { margin-left: 3em; }

        /* RFC-2629 <spanx>s and <artwork>s. */
        em     { font-style: italic; }
        strong { font-weight: bold; }
        dfn    { font-weight: bold; font-style: normal; }
        cite   { font-weight: normal; font-style: normal; }
        tt     { color: #036; }
        tt, pre, pre dfn, pre em, pre cite, pre span {
                font-family: "Courier New", Courier, monospace; font-size: small;
        }
        pre {
                text-align: left; padding: 4px;
                color: #000; background-color: #CCC;
        }
        pre dfn  { color: #900; }
        pre em   { color: #66F; background-color: #FFC; font-weight: normal; }
        pre .key { color: #33C; font-weight: bold; }
        pre .id  { color: #900; }
        pre .str { color: #000; background-color: #CFF; }
        pre .val { color: #066; }
        pre .rep { color: #909; }
        pre .oth { color: #000; background-color: #FCF; }
        pre .err { background-color: #FCC; }

        /* RFC-2629 <texttable>s. */
        table.all, table.full, table.headers, table.none {
                font-size: small; text-align: center; border-width: 2px;
                vertical-align: top; border-collapse: collapse;
        }
        table.all, table.full { border-style: solid; border-color: black; }
        table.headers, table.none { border-style: none; }
        th {
                font-weight: bold; border-color: black;
                border-width: 2px 2px 3px 2px;
        }
        table.all th, table.full th { border-style: solid; }
        table.headers th { border-style: none none solid none; }
        table.none th { border-style: none; }
        table.all td {
                border-style: solid; border-color: #333;
                border-width: 1px 2px;
        }
        table.full td, table.headers td, table.none td { border-style: none; }

        hr { height: 1px; }
        hr.insert {
                width: 80%; border-style: none; border-width: 0;
                color: #CCC; background-color: #CCC;
        }
--></style>
</head>
<body>
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<table summary="layout" width="66%" border="0" cellpadding="0" cellspacing="0"><tr><td><table summary="layout" width="100%" border="0" cellpadding="2" cellspacing="1">
<tr><td class="header">Network Working Group</td><td class="header">J. Bradeley</td></tr>
<tr><td class="header">Internet-Draft</td><td class="header">Protivity Government Services</td></tr>
<tr><td class="header">Intended status: Informational</td><td class="header">N. Sakimura (Editor)</td></tr>
<tr><td class="header">Expires: April 2, 2011</td><td class="header">Nomura Research Institute</td></tr>
<tr><td class="header"> </td><td class="header">September 29, 2010</td></tr>
</table></td></tr></table>
<h1><br />JSON Simple Encryption ver.1 draft00<br />json-simple-enc-1_0</h1>

<h3>Abstract</h3>

<p>This document defines a lightweight mechanism for encrypting arbitrary data to be encrypted and enveloped in JSON together with necessary encryption parameters.
</p>
<h3>Requirements Language</h3>

<p>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 <a class='info' href='#RFC2119'>RFC 2119<span> (</span><span class='info'>Bradner, S., “Key words for use in RFCs to Indicate Requirement Levels,” March 1997.</span><span>)</span></a> [RFC2119].
</p>
<h3>Status of this Memo</h3>
<p>
This Internet-Draft is submitted  in full
conformance with the provisions of BCP 78 and BCP 79.</p>
<p>
Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF).  Note that other groups may also distribute
working documents as Internet-Drafts.  The list of current
Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.</p>
<p>
Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any time.
It is inappropriate to use Internet-Drafts as reference material or to cite
them other than as “work in progress.”</p>
<p>
This Internet-Draft will expire on April 2, 2011.</p>

<h3>Copyright Notice</h3>
<p>
Copyright (c) 2010 IETF Trust and the persons identified as the
document authors.  All rights reserved.</p>
<p>
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of
publication of this document.  Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.</p>
<a name="toc"></a><br /><hr />
<h3>Table of Contents</h3>
<p class="toc">
<a href="#anchor1">1.</a> 
JSON Encryption Envelope<br />
    <a href="#params">1.1.</a> 
Envelope Parameters<br />
    <a href="#anchor2">1.2.</a> 
The JSON Serialization<br />
<a href="#IANA">2.</a> 
IANA Considerations<br />
<a href="#Security">3.</a> 
Security Considerations<br />
<a href="#Acknowledgements">4.</a> 
Acknowledgements<br />
<a href="#rfc.references1">5.</a> 
References<br />
    <a href="#rfc.references1">5.1.</a> 
Normative References<br />
    <a href="#rfc.references2">5.2.</a> 
Informative References<br />
<a href="#anchor5">Appendix A.</a> 
An Appendix<br />
<a href="#rfc.authors">§</a> 
Authors' Addresses<br />
</p>
<br clear="all" />

<a name="anchor1"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<a name="rfc.section.1"></a><h3>1. 
JSON Encryption Envelope</h3>

<p>JSON Encryption Envelope comprises a message bundled along with encryption parameters for that message, expressed as a series of parameters, and serialized as JSON in <a class='info' href='#RFC4627'>RFC 4627<span> (</span><span class='info'>Crockford, D., “The application/json Media Type for JavaScript Object Notation (JSON),” July 2006.</span><span>)</span></a> [RFC4627]. The envelope specifies the data that was encrypted, the MIME type of the data, the transfer encoding, and the encryption parameters.
</p>
<p>
</p>
<a name="params"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<a name="rfc.section.1.1"></a><h3>1.1. 
Envelope Parameters</h3>

<p></p>
<ul class="text">
<li>type
<blockquote class="text">
<p>Value: "http://jsonenc.info/json-encryption/"
</p>
</blockquote>
</li>
<li>data_type
<blockquote class="text">
<p>Value: The MIME type OR the Type URL of the payload prior to encoding
</p>
</blockquote>
</li>
<li>enc_data
<blockquote class="text">
<p>Value: <a class='info' href='#RFC1952'>RFC1962<span> (</span><span class='info'>Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and G. Randers-Pehrson, “GZIP file format specification version 4.3,” May 1996.</span><span>)</span></a> [RFC1952] compressed (gzip), Encrypted and Base64url encoded data.
</p>
</blockquote>
</li>
<li>enc_key
<blockquote class="text">
<p>Value: The symmetric encryption key that was used for the encryption of the payload encrypted with the algorithm specified in 'enc_type_asy' by the Public specified by the RP then Base64url encoded.
</p>
</blockquote>
</li>
<li>enc_iv
<blockquote class="text">
<p>Value: (Optional) Base64 encoded initialization vector. It SHOULD be different for each encryption. The default IV is null, however, using null as the IV is strongly discouraged.
</p>
</blockquote>
</li>
<li>enc_type_asy
<blockquote class="text">
<p>Value: (Optional) Asymmetric cypher type expressed in the Type URL from <a class='info' href='#xml_enc'>XML Encryption<span> (</span><span class='info'>Imamura, T., “XML Encryption Syntax and Processing,” December 2002.</span><span>)</span></a> [xml_enc]
</p>
<p></p>
<ul class="text">
<li>(Default) RSA-v1.5 http://www.w3.org/2001/04/xmlenc#rsa-1_5 : RSA Encryption with PKCS1_PADDING.
</li>
<li>RSA-OAEP http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p : RSA Encryption with PKCS1_OAEP_PADDING.
</li>
</ul>One MAY use other Type URLs if so desired.

</blockquote>
</li>
<li>enc_type
<blockquote class="text">
<p>Value: (Optional) String expressing the encryption type. Default is "AES-128-CBC". Possible values are:
</p>
<p></p>
<ul class="text">
<li>"PLAIN" No encryption base64 encoding only
</li>
<li>"AES-128-CBC" 128 bit AES encryption in CBC mode (default) . Short hand for "http://www.w3.org/2001/04/xmlenc#aes128-cbc".
</li>
<li>"AES-256-CBC" 256 bit AES encryption in CBC mode. Short hand for "http://www.w3.org/2001/04/xmlenc#aes256-cbc"
</li>
<li>"ECDH-ES" Eliptic Curve Diffie-Helman Ephemeral Secret. Short hand for "http://www.w3.org/2009/xmlenc11#ECDH-ES"
</li>
</ul>One MAY define other Type URL if so desired.

</blockquote>
</li>
<li>enc_ref
<blockquote class="text">
<p>Value: (Optional) URI of the PEM format X.509 Certificate that corresponds to the public key encryption of the symmetric key.
</p>
</blockquote>
</li>
<li>enc_certs
<blockquote class="text">
<p>Value: (Optional) Base64url encoded DER format X.509 Certificate that corresponds to the public key encryption of the symmetric key.
</p>
</blockquote>
</li>
<li>enc_ephemeral_pub_key
<blockquote class="text">
<p>Value: (Optional) The ephemeral public key created by the originator for the use in ECDH-ES encryption. It is a JSON object that has two parameters "curve" and "key" where "curve" is URI of the named curve and "key" is the base64url encoded key.
</p>
</blockquote>
</li>
<li>enc_thumbprint
<blockquote class="text">
<p>Value: (Optional) A SHA1 of the DER encoded certificate.
</p>
<p>Note: One may calculate this value as in the follwoing non-normative example from a PEM encoded certificate:
</p>
<p></p>
<div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre>openssl x509 -in cer.cert -text | perl -ne 'print if /BEGIN/../END/' | openssl base64 -d | openssl sha1 -hex</pre></div><p>

</p>
</blockquote>
</li>
</ul>

<a name="anchor2"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<a name="rfc.section.1.2"></a><h3>1.2. 
The JSON Serialization</h3>

<p>JSON Encryption Envelope MUST be well formed JSON as defined in <a class='info' href='#RFC4627'>[RFC4627]<span> (</span><span class='info'>Crockford, D., “The application/json Media Type for JavaScript Object Notation (JSON),” July 2006.</span><span>)</span></a>. The parameters are serialized into a JSON object as a sequence of name/value pairs for the parameter described in <a class='info' href='#params'>Section 1.1<span> (</span><span class='info'>Envelope Parameters</span><span>)</span></a>.
</p>
<p>Additional name/value pairs MAY appear within the JSON object and processors MUST ignore elements they do not understand.
</p>
<p>Example:
</p>
<p>
</p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre>
{
    "object_type":"http://jsonenc.info/json-encryption/",
    "enc_data":"b5guwzFgvrIUd7XcXI0bAFrg-....O69VKhY",
    "enc_key":"mHM2ongmZlPVexe....2lsBNdw",
    "enc_iv":"_b4INfYIRwLPZdxB2L7wJg",
    "enc_type":"AES-128-CBC',
    "enc_ref":"https://rp.example.com/certs.pem"
}


</pre></div>
<p>
</p>
<a name="IANA"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<a name="rfc.section.2"></a><h3>2. 
IANA Considerations</h3>

<p>This document makes no request of IANA.
</p>
<a name="Security"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<a name="rfc.section.3"></a><h3>3. 
Security Considerations</h3>

<p>The symmetric encryption key should be generated with a reliable pseudo-random number generator to achieve high entropy.
</p>
<p>The initialization vector should be generated with a reliable pseudo-random number generator to achieve high entropy.
</p>
<a name="Acknowledgements"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<a name="rfc.section.4"></a><h3>4. 
Acknowledgements</h3>

<p>
</p>
<a name="rfc.references"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<a name="rfc.section.5"></a><h3>5. 
References</h3>

<a name="rfc.references1"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<h3>5.1. Normative References</h3>
<table width="99%" border="0">
<tr><td class="author-text" valign="top"><a name="RFC1952">[RFC1952]</a></td>
<td class="author-text"><a href="mailto:ghost@aladdin.com">Deutsch, P.</a>, <a href="mailto:gzip@prep.ai.mit.edu">Gailly, J-L.</a>, <a href="mailto:madler@alumni.caltech.edu">Adler, M.</a>, <a href="mailto:ghost@aladdin.com">Deutsch, L.</a>, and <a href="mailto:randeg@alumni.rpi.edu">G. Randers-Pehrson</a>, “<a href="http://tools.ietf.org/html/rfc1952">GZIP file format specification version 4.3</a>,” RFC 1952, May 1996 (<a href="http://www.rfc-editor.org/rfc/rfc1952.txt">TXT</a>, <a href="http://www.rfc-editor.org/rfc/rfc1952.ps">PS</a>, <a href="http://www.rfc-editor.org/rfc/rfc1952.pdf">PDF</a>).</td></tr>
<tr><td class="author-text" valign="top"><a name="RFC2119">[RFC2119]</a></td>
<td class="author-text"><a href="mailto:sob@harvard.edu">Bradner, S.</a>, “<a href="http://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>,” BCP 14, RFC 2119, March 1997 (<a href="http://www.rfc-editor.org/rfc/rfc2119.txt">TXT</a>, <a href="http://xml.resource.org/public/rfc/html/rfc2119.html">HTML</a>, <a href="http://xml.resource.org/public/rfc/xml/rfc2119.xml">XML</a>).</td></tr>
<tr><td class="author-text" valign="top"><a name="RFC4627">[RFC4627]</a></td>
<td class="author-text">Crockford, D., “<a href="http://tools.ietf.org/html/rfc4627">The application/json Media Type for JavaScript Object Notation (JSON)</a>,” RFC 4627, July 2006 (<a href="http://www.rfc-editor.org/rfc/rfc4627.txt">TXT</a>).</td></tr>
<tr><td class="author-text" valign="top"><a name="xml_enc">[xml_enc]</a></td>
<td class="author-text">Imamura, T., “<a href="http://www.w3.org/TR/xmlenc-core/">XML Encryption Syntax and Processing</a>,” December 2002.</td></tr>
</table>

<a name="rfc.references2"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<h3>5.2. Informative References</h3>
<table width="99%" border="0">
</table>

<a name="anchor5"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<a name="rfc.section.A"></a><h3>Appendix A. 
An Appendix</h3>

<p>
</p>
<a name="rfc.authors"></a><br /><hr />
<table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table>
<h3>Authors' Addresses</h3>
<table width="99%" border="0" cellpadding="0" cellspacing="0">
<tr><td class="author-text"> </td>
<td class="author-text">John Bradeley</td></tr>
<tr><td class="author-text"> </td>
<td class="author-text">Protivity Government Services</td></tr>
<tr cellpadding="3"><td> </td><td> </td></tr>
<tr><td class="author-text"> </td>
<td class="author-text">Nat Sakimura</td></tr>
<tr><td class="author-text"> </td>
<td class="author-text">Nomura Research Institute</td></tr>
</table>
</body></html>