Switched to respec
author"arangana <arun@mozilla.com>"
Thu, 16 May 2013 17:05:26 -0400
changeset 30 4f81f389188c
parent 29 84475d90b564
child 31 cc4724a8d1f6
Switched to respec
Overview.html
--- a/Overview.html	Wed Apr 10 17:11:51 2013 -0400
+++ b/Overview.html	Thu May 16 17:05:26 2013 -0400
@@ -1,207 +1,168 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml">
+<!DOCTYPE html>
+<html>
   <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     <title>Web Cryptography API Use Cases</title>
-
-    <meta name="revision" content="$Id: Overview-FA.xml,v 1.164 2013/01/08 12:23:12 arangana Exp $" />
-
-    <link rel="stylesheet" href="FileAPI.css" type="text/css" />
-    <script src="section-links.js" type="application/ecmascript"></script>
-    <script src="dfn.js" type="application/ecmascript"></script>
-    <!--[if IE]>
-    <style type='text/css'>
-      .ignore {
-        -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
-        filter: alpha(opacity=50);
-      }
-    </style>
-    <![endif]-->
-
-    
-  <link rel="stylesheet" href="http://www.w3.org/StyleSheets/TR/W3C-ED" type="text/css" /></head>
-
-  <body>
-    <div class="head"><div><a href="http://www.w3.org/"><img src="http://www.w3.org/Icons/w3c_home" width="72" height="48" alt="W3C" /></a></div><h1>Web Cryptography API Use Cases</h1><h2>W3C Editor's Draft <em>April 10 2013</em></h2><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> &copy; 2013 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>&reg;</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply.</p></div><hr />
-
-    <div class="section">
-      <h2>Abstract</h2>
-     <p>
-      This document is NOT a recommendation track document, and should be read as an informative overview of the target use cases for a cryptographic API for the web.  These use cases, described as <em>scenarios</em>, represent some of the set of expected functionality that may be achieved by the <a href="#WebCrypto">Web Cryptography API</a>, which provides an API for cryptographic operations such as encryption and decryption, and the <a href="#KeyDiscovery">Key Discovery API</a>, which specifically covers the ability to access cryptographic keys that have been <a href="#pre-prov"><em>pre-provisioned</em></a>. As both APIs are under construction, the reader should consult each specification for changes, and should treat sample code provided here as illustrative only.  Presented here are <em>primary</em> use cases, showing what the working group hopes to achieve first.  Other use cases are marked as <em>secondary</em>.
-    </p>
-
-
-      
-    </div>
+    <meta charset='utf-8'>
+    <script src='http://darobin.github.com/respec/builds/respec-w3c-common.js' class='remove'></script>
+    <script class='remove'>
+      var respecConfig = {
+          // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
+          specStatus:           "ED",
+          
+          // the specification's short name, as in http://www.w3.org/TR/short-name/
+          shortName:            "webcrypto-usecases",
 
-    <div class="section">
-      <h2>Status of this Document</h2>
-      <p><em>
-        This section describes the status of this document at the time of
-        its publication.  Other documents may supersede this document. A list
-        of current W3C publications and the latest revision of this technical
-        report can be found in the <a href="http://www.w3.org/TR/">W3C technical
-          reports index</a> at http://www.w3.org/TR/.
-      </em></p><p>
-        This document is the April 10 2013 <b>Editor's Draft</b> of the
-        <cite>Web Cryptography API Use Cases</cite> specification.
-      
-      Please send comments about this document to
-      <a href="mailto:public-webcrypto@w3.org">public-webcrypto@w3.org</a>
-      (<a href="http://lists.w3.org/Archives/Public/public-webcrypto/">archived</a>).
-    </p>
-      <p>
-         This document is not a recommendation track document, and is presented for information purposes only.  Ongoing discussion of this document will be on the <a href="mailto:public-webcrypto@w3.org">public-webcrypto@w3.org</a>
-        mailing list.
-      </p>
-      
-      <p>
-      <em>This section describes the status of this document at the time of its publication.
-      Other documents may supersede this document, since it is only an editor's draft.
-      A list of current <acronym title="World Wide Web Consortium">W3C</acronym>
-      publications and the latest revision of this technical report can be found in the 
-      <a href="http://www.w3.org/TR/"><acronym title="World Wide Web Consortium">W3C</acronym>
-      technical reports index</a> at <a href="http://www.w3.org/TR/">http://www.w3.org/TR/</a>.</em>
-      </p>
+          // if your specification has a subtitle that goes below the main
+          // formal title, define it here
+          // subtitle   :  "an excellent document",
 
-    <p>
-      This document is produced by the <a href="http://www.w3.org/2012/webcrypto/">Web <acronym title="Cryptography">Cryptography</acronym>
-      <acronym title="Working Group">WG</acronym></a> in the <acronym title="World Wide Web Consortium">W3C</acronym>
-      <a href="http://www.w3.org/Interaction/">Interaction Domain</a>.
-    </p>
-    <p>
-      Web content and browser developers are encouraged to review this draft. Please send comments to
-      <a href="mailto:public-webcrypto@w3.org">public-webcrypto@w3.org</a>, the <acronym title="World Wide Web Consortium">W3C</acronym>'s
-      public email list for issues related to Web <acronym title="Application Programming Interface">API</acronym>s.
-      <a href="http://lists.w3.org/Archives/Public/public-webcrypto/">Archives</a> of the
-      list are available.
-    </p>
-    <p>
-        This document is produced by the <a href="http://www.w3.org/2012/webcrypto/">Web Cryptography Working Group</a>, within
-        the W3C <a href="http://www.w3.org/Interaction/">Interaction Domain</a>.
-        Changes made to this document can be found in the
-        <a href="https://dvcs.w3.org/hg/webcrypto-usecases">W3C public Mercurial Repository</a>.
-    </p>
-      <p>
-          Publication as an Editor's Draft does not imply endorsement by the
-          W3C Membership.  This is a draft document and may be updated, replaced
-          or obsoleted by other documents at any time. It is inappropriate to cite
-          this document as other than work in progress.
-        </p><p> This document was produced by a group operating under the <a
-href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February
-2004 W3C Patent Policy</a>. The group does not expect this document to
-become a W3C Recommendation. W3C maintains a <a rel="disclosure"
-href="http://www.w3.org/2004/01/pp-impl/54174/status">public list of any
-patent disclosures</a> made in connection with the deliverables of the
-group; that page also includes instructions for disclosing a patent. An
-individual who has actual knowledge of a patent which the individual
-believes contains <a
-href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential
-Claim(s)</a> must disclose the information in accordance with <a
-href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section
-6 of the W3C Patent Policy</a>. </p>
-    </div>
+          // if you wish the publication date to be other than today, set this
+          // publishDate:  "2009-08-06",
 
-    <div id="toc">
-      <h2>Table of Contents</h2>
-      <div class="toc"><ul><li><a href="#introduction">1. Introduction</a></li><li><a href="#requirements">2. Requirements</a></li><li><a href="#scenarios">3. Use Case Scenarios</a><ul><li><a href="#banking">3.1. Banking Transactions</a></li><li><a href="#video-service">3.2. Video Services</a></li><li><a href="#data-integrity">3.3. Code Sanctity and Bandwidth Saver</a></li><li><a href="#encryptedWebMail">3.4. Encrypted Communications via Webmail</a></li><li><a href="#realtime-messaging">3.5. Off The Record Real Time Messaging</a></li><li><a href="#savemystuff">3.6. Documents In the Cloud</a></li></ul></li><li><a href="#references">4. References</a></li></ul></div>
-    </div>
+          // if the specification's copyright date is a range of years, specify
+          // the start date here:
+          // copyrightStart: "2005"
 
-    <div id="sections">
-    <div id="introduction" class="section">
-    <h2>1. Introduction</h2>
-      <p>The <a href="#WebCrypto">Web Cryptography API</a> describes a JavaScript API for user agents such as web browsers, and exposes basic cryptographic operations, including: digesting, signature generation and verification, encryption, decryption, cryptographic key generation, key derivation, key import and key export.  The <a href="#KeyDiscovery">Key Discovery API</a> describes a JavaScript API to invoke <a href="#pre-prov">pre-provisioned keys</a>.  This document presents use cases in the form of scenarios that cover the use of both APIs, with each scenario describing a potential web application using these APIs.  Where possible, code snippets have been provided to demonstrate what a developer might do when addressing the use case.</p>
-    </div>
-    <div id="requirements" class="section">
-    <h2>2. Requirements</h2>
-    <p>This section presents required features of a cryptographic API.  It is possible that there is more than one algorithm and more than one mechanism to accomplish each of these features.  The section presents code names for each of the features, which will be used alongside each scenario, illustrating which feature is used.</p>
+          // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
+          // and its maturity status
+          // previousPublishDate:  "1977-03-15",
+          // previousMaturity:  "WD",
+
+          // if there a publicly available Editor's Draft, this is the link
+          edDraftURI:           "https://dvcs.w3.org/hg/webcrypto-usecases/raw-file/tip/Overview.html",
+
+          // if this is a LCWD, uncomment and set the end of its review period
+          // lcEnd: "2009-08-05",
+
+          // editors, add as many as you like
+          // only "name" is required
+          editors:  [
+              { name: "Arun Ranganathan", url: "http://arunranga.com",
+                company: "Mozilla", companyURL: "http://www.mozilla.org/" },
+          ],
+
+          // authors, add as many as you like. 
+          // This is optional, uncomment if you have authors as well as editors.
+          // only "name" is required. Same format as editors.
+
+          //authors:  [
+          //    { name: "Your Name", url: "http://example.org/",
+          //      company: "Your Company", companyURL: "http://example.com/" },
+          //],
+          
+          // name of the WG
+          wg:           "Web Cryptography Working Group",
+          
+          // URI of the public WG page
+          wgURI:        "http://example.org/really-cool-wg",
+          
+          // name (without the @w3c.org) of the public mailing to which comments are due
+          wgPublicList: "public-webcrypto",
+          
+          // URI of the patent status for this WG, for Rec-track documents
+          // !!!! IMPORTANT !!!!
+          // This is important for Rec-track documents, do not copy a patent URI from a random
+          // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
+          // Team Contact.
+          // wgPatentURI:  "",
+      };
+    </script>
+  </head>
+  <body>
+    <section id='abstract'>
+      This document is NOT a recommendation track document, and should be read as an informative overview of the target use cases for a cryptographic API for the web. These use cases, described as scenarios, represent some of the set of expected functionality that may be achieved by the Web Cryptography API [WEBCRYPTO]  which provides an API for cryptographic operations such as encryption and decryption, and the Key Discovery API [KEY-DISCOVERY], which specifically covers the ability to access cryptographic keys that have been pre-provisioned. As both APIs are under construction, the reader should consult each specification for changes, and should treat sample code provided here as illustrative only. Presented here are primary use cases, showing what the working group hopes to achieve first. Other use cases are marked as secondary. 
+    </section>
+    
+    <section>
+      <h2>Requirements</h2>
+      <p>This section presents required features of a cryptographic API.  It is possible that there is more than one algorithm and more than one mechanism to accomplish each of these features.  The section presents code names for each of the features, which will be used alongside each scenario, illustrating which feature is used.</p>
     <ul>
-      <li><p><dfn id="digest">DIGEST</dfn>, the ability to perform a cryptographic hash, where an algorithm that takes an arbitrary block of data returns a fixed-size bit sequence, called the <dfn id="hash-value">hash value</dfn>, such that any change to the block of data changes the hash value.</p></li>
-      <li><p><dfn id="mac">MAC</dfn>, the ability to generate a <em>message authentication code</em>, using an algorithm, with <dfn id="hmac">HMAC</dfn> being a specific kind of message authentication code, with a specific algorithm.</p></li>
-      <li><p><dfn id="sign">SIGN</dfn>, the ability to digitally sign a document with a private key, such that upon verification of the signature with the corresponding public key, the document's authenticity from the point of view of the signature can be determined.  The term document in this context can refer to any kind of data used with web applications.</p></li>
-      <li><p><dfn id="verify">VERIFY</dfn>, the ability to verify a digitally signed document, as well as verify a MAC or HMAC.</p></li>
-      <li><p><dfn id="encrypt">ENCRYPT</dfn>, the ability to encode a document using an encryption algorithm.  <dfn id="encrypt-sym">ENCRYPT-SYM</dfn> is a specific type of encryption using symmetric cryptographic keys, and <dfn id="encrypt-assym">ENCRYPT-ASSYM</dfn> is a specific type of encryption using assymetric cryptographic keys, typically a public and private key pair.</p></li> 
-      <li><p><dfn id="decrypt">DECRYPT</dfn>, the ability to decrypt a digitally signed document.  <dfn id="decrypt-sym">DECRYPT-SYM</dfn> is a specific type of decryption using symmetric keys, and <dfn id="decrypt-assym">DECRYPT-ASSYM</dfn> is a specific type of decryption using assymetric keys, typically a public and private key pair.</p></li>
-      <li><p><dfn id="derive">DERIVE</dfn>, the ability to derive a key or key pair used in cryptographic operations; <dfn id="derive-assym">DERIVE-ASSYM</dfn> is the ability to derive assymetric keys, typically a public and private key pair, for use with assymetric cryptographic operations, and <dfn id="derive-sym">DERIVE-SYM</dfn> is the ability to derive a symmetric key for use with symmetric cryptographic operations.</p></li>
-      <li><p><dfn id="import">IMPORT</dfn>, the ability to import a key or key pair that have already been created elsewhere, for use within the web application that is invoking the import function, for use within the importing web application's origin.  This necessiates an interoperable key format, which may be represented as octets.</p></li>
-      <li><p><dfn id="export">EXPORT</dfn>, the ability to export a key or key pair that can be accessed from within the application that is invoking the export function.  This necessiates an interoperable key format, which may be represented as octets, that other web applications can then import.</p></li>
-      <li><p><dfn id="keyex">KEYEX</dfn>, the ability for two entities to exchange key(s) without interception by a third party, with <dfn id="keyex-dh">KEYEX-DH</dfn> representing Diffie-Hellman key exchange, a common application of safe key exchange.</p></li>
-      <li><p><dfn id="keycall">KEYCALL</dfn>, the ability to access a particular key (or key pair) from within a web application's key storage, which is within the web application's origin only.  Here, the key storage might be IndexedDB or localStorage, and the key or key pair might have been created by the web application or imported by the web application.</p></li>
-      <li><p><dfn id="sym">-SYM</dfn>, an abbreviation for <em>symmetric key cryptographic operations</em>, used in this document as a suffix to other features to specifically clarify the feature being invoked by the web application.</p></li>
-      <li><p><dfn id="assym">ASSYM</dfn>, an abbreviation for <em>assymetric key cryptographic operations</em>, typically involving a public and private key pair, used in this document as a suffix to other features to specifically clarify the feature being invoked by the web application.</p></li>
-      <li><p><dfn id="random">RANDOM</dfn>, the ability to generate cryptographically secure random numbers.</p></li>
+      <li><p><dfn title="digest" id="digest">DIGEST</dfn>, the ability to perform a cryptographic hash, where an algorithm that takes an arbitrary block of data returns a fixed-size bit sequence, called the <dfn id="hash-value">hash value</dfn>, such that any change to the block of data changes the hash value.</p></li>
+      <li><p><dfn title="mac" id="mac">MAC</dfn>, the ability to generate a <em>message authentication code</em>, using an algorithm, with <dfn id="hmac">HMAC</dfn> being a specific kind of message authentication code, with a specific algorithm.</p></li>
+      <li><p><dfn title="sign" id="sign">SIGN</dfn>, the ability to digitally sign a document with a private key, such that upon verification of the signature with the corresponding public key, the document's authenticity from the point of view of the signature can be determined.  The term document in this context can refer to any kind of data used with web applications.</p></li>
+      <li><p><dfn title="verify" id="verify">VERIFY</dfn>, the ability to verify a digitally signed document, as well as verify a MAC or HMAC.</p></li>
+      <li><p><dfn title="encrypt" id="encrypt">ENCRYPT</dfn>, the ability to encode a document using an encryption algorithm.  <dfn id="encrypt-sym">ENCRYPT-SYM</dfn> is a specific type of encryption using symmetric cryptographic keys, and <dfn id="encrypt-assym">ENCRYPT-ASSYM</dfn> is a specific type of encryption using assymetric cryptographic keys, typically a public and private key pair.</p></li> 
+      <li><p><dfn title="decrypt" id="decrypt">DECRYPT</dfn>, the ability to decrypt a digitally signed document.  <dfn id="decrypt-sym">DECRYPT-SYM</dfn> is a specific type of decryption using symmetric keys, and <dfn id="decrypt-assym">DECRYPT-ASSYM</dfn> is a specific type of decryption using assymetric keys, typically a public and private key pair.</p></li>
+      <li><p><dfn title="derive" id="derive">DERIVE</dfn>, the ability to derive a key or key pair used in cryptographic operations; <dfn id="derive-assym">DERIVE-ASSYM</dfn> is the ability to derive assymetric keys, typically a public and private key pair, for use with assymetric cryptographic operations, and <dfn id="derive-sym">DERIVE-SYM</dfn> is the ability to derive a symmetric key for use with symmetric cryptographic operations.</p></li>
+      <li><p><dfn title="import" id="import">IMPORT</dfn>, the ability to import a key or key pair that have already been created elsewhere, for use within the web application that is invoking the import function, for use within the importing web application's origin.  This necessiates an interoperable key format, which may be represented as octets.</p></li>
+      <li><p><dfn title="export" id="export">EXPORT</dfn>, the ability to export a key or key pair that can be accessed from within the application that is invoking the export function.  This necessiates an interoperable key format, which may be represented as octets, that other web applications can then import.</p></li>
+      <li><p><dfn title="keyex" id="keyex">KEYEX</dfn>, the ability for two entities to exchange key(s) without interception by a third party, with <dfn id="keyex-dh">KEYEX-DH</dfn> representing Diffie-Hellman key exchange, a common application of safe key exchange.</p></li>
+      <li><p><dfn title="keycall" id="keycall">KEYCALL</dfn>, the ability to access a particular key (or key pair) from within a web application's key storage, which is within the web application's origin only.  Here, the key storage might be IndexedDB or localStorage, and the key or key pair might have been created by the web application or imported by the web application.</p></li>
+      <li><p><dfn title="sym" id="sym">-SYM</dfn>, an abbreviation for <em>symmetric key cryptographic operations</em>, used in this document as a suffix to other features to specifically clarify the feature being invoked by the web application.</p></li>
+      <li><p><dfn title="assym" id="assym">-ASSYM</dfn>, an abbreviation for <em>assymetric key cryptographic operations</em>, typically involving a public and private key pair, used in this document as a suffix to other features to specifically clarify the feature being invoked by the web application.</p></li>
+      <li><p><dfn title="random" id="random">RANDOM</dfn>, the ability to generate cryptographically secure random numbers.</p></li>
     </ul> 
     <p>Additionally, the Web Cryptography WG is actively discussing three other features:</p>
     <ul>
-      <li><p><dfn id="wrap">WRAP</dfn> which allows a web application to use a key to <em>wrap another key</em>, so that the wrapped key can be unwrapped by a party with the corresponding wrapping key, but is hard to obtain or unwrap by anyone without the corresponding wrapping key.  While it is possible to create a key-wrapping and unwrapping mechanism with the other features listed, this feature provides a way to do so without exposing the key to be wrapped to JavaScript. </p>
-      <div class="ednote"><div class="ednoteHeader">Editorial note</div>Would WRAP and UNWRAP benefit from -SYM or -ASSYM qualifiers?</div></li>
-      <li><p><dfn id="unwrap">UNWRAP</dfn> which allows a web application to use a key to unwrap another encrypted key or key pair, which can then be used in standard cryptographic operations.  While it is possible to create a key-wrapping and unwrapping mechanism with the other features listed, this feature provides a way to do so without exposing the key to be wrapped to JavaScript.</p>
-      <div class="ednote"><div class="ednoteHeader">Editorial note</div><p>This feature is subject to discussion, including further work by the JOSE WG.  See <a href="https://www.w3.org/2012/webcrypto/track/issues/35">ISSUE-35</a> logged by the WebCrypto WG.</p></div>
+      <li><p><dfn title="wrap" id="wrap">WRAP</dfn> which allows a web application to use a key to <em>wrap another key</em>, so that the wrapped key can be unwrapped by a party with the corresponding wrapping key, but is hard to obtain or unwrap by anyone without the corresponding wrapping key.  While it is possible to create a key-wrapping and unwrapping mechanism with the other features listed, this feature provides a way to do so without exposing the key to be wrapped to JavaScript. <dfn title="wrap-sym" id="wrap-sym">WRAP-SYM</dfn> refers to symmetric key wrapping, and <dfn title="wrap-assym">WRAP-ASSYM</dfn> refers to assymetric key wrapping.</p>
+      <li><p><dfn id="unwrap">UNWRAP</dfn> which allows a web application to use a key to unwrap another encrypted key or key pair, which can then be used in standard cryptographic operations.  While it is possible to create a key-wrapping and unwrapping mechanism with the other features listed, this feature provides a way to do so without exposing the key to be wrapped to JavaScript.  <dfn id="unwrap-sym" title="unwrap-sym">UNWRAP-SYM</dfn> refers to symmetric unwrapping, and <dfn id="unwrap-assym" title="unwrap-assym">UNWRAP-ASSYM</dfn> refers to assymetric unwrapping.</p>
+      <div class="issue"><p>This feature is subject to discussion, including further work by JOSE [JOSE].  See <a href="https://www.w3.org/2012/webcrypto/track/issues/35">ISSUE-35</a> logged by the WebCrypto WG.</p></div>
     </li>
 
       <li><p><dfn id="namedkey">NAMEDKEY</dfn> which allows an application in JavaScript to discover a <dfn id="pre-prov">pre-provisioned</dfn> key within the scope of the application's origin, which exists at the time of the application's first invocation, and has not been derived, generated or imported by the application using any of the features listed above; such keys may have been provisioned by a device manufacturer, for example, and the JavaSript application can access them for initial authorization and authentication at time of first invocation. </p>
-      <div class="note"><div class="noteHeader">Note</div><p>This feature is developed in the <a href="#KeyDiscovery">Key Discovery API</a>.</p></div>
+      <div class="note"><p>This feature is developed in the Key Discovery API [KEY-DISCOVERY].</p></div>
     </li>
   </ul>
-    </div>
-    <div id="scenarios" class="section">
-      <h2>3. Use Case Scenarios</h2>
-      <p>This section collates use case scenarios that leverages the <a href="#WebCrypto">WebCrypto API</a> or the <a href="#KeyDiscovery">Key Discovery API</a>.  Where possible, sample code is provided, and should be considered illustrative only, since the underlying API specifications are changing.</p>
-      <div id="banking" class="section">
-      <h3>3.1. Banking Transactions</h3>
+    </section>
+    <section>
+      <h2>Use Case Scenarios</h2>
+      <p>This section collates use case scenarios that leverages the WebCrypto API [WEBCRYPTO] or the Key Discovery API [KEY-DISCOVERY].  Where possible, sample code is provided, and should be considered illustrative only, since the underlying API specifications are changing.</p>
+    
+      <section>
+      <h3>Banking Transactions</h3>
       <p>Park Jae-sang opens up a bank account with Gangnam Bank, and wishes to log-in and engage in online transactions, including account balance checking, online payments (with some automated scheduled payments), and account transfers between domestic and investment accounts.  The first time Park logs in to the Gangnam Bank website (Gangnam Bank's website from now on will be abbreviated "GB") with a temporary verification code sent to his cell phone, the bank asks him to ascertain if the browser he is using is not at a kiosk; moreover, he is asked if it is a web browser and machine configuration he will use often.</p>
-      <p>He confirms that it is.  The GB web site then asks him to generate a public key/private key pair.  Park consents, and the web page creates the key pair, storing his private key in the browser's designated key store, along with a one-time key escrow by the bank.  Additionally, Jae-sang is presented with the bank's public key, such that documents issued by the bank can be verified and decrypted; Jae-sang presents the derived public key to GB.  Jae-sang is also presented with a user guide that explains the validity period of the key pair, and for how long they will persist.  [<a href="#derive">DERIVE</a> | <a href="#keyex-dh">KEYEX-DH</a>].</p>
-      <div class="example"><div class="exampleHeader">Example</div>
-      <p>GB may first generate some key pairs for Jae-sang.  These include the public key/private key pair which will be used for digital signatures.</p>
-      <div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
-  <span class="comment">// Algorithm Object</span>
+      <p>He confirms that it is.  The GB web site then asks him to generate a public key/private key pair.  Park consents, and the web page creates the key pair, storing his private key in the browser's designated key store, along with a one-time key escrow by the bank.  Additionally, Jae-sang is presented with the bank's public key, such that documents issued by the bank can be verified and decrypted; Jae-sang presents the derived public key to GB.  Jae-sang is also presented with a user guide that explains the validity period of the key pair, and for how long they will persist.  [<a title="derive">DERIVE</a> | <a title="keyex">KEYEX</a>].</p>
+      <p>GB may first generate some key pair for Jae-sang.  These include the public key/private key which will be used for digital signatures. </p>
+
+      <pre class="example hightlight prettyprint">
+
+// Algorithm Object
 var algorithmKeyGen = {
 name: "RSASSA-PKCS1-v1_5",
-<span class="comment">// RsaKeyGenParams</span>
+// RsaKeyGenParams
   params: {
     modulusLength: 2048,
-    publicExponent: new Uint8Array([0x01, 0x00, 0x01]),  <span class="comment">// Equivalent to 65537</span>
+    publicExponent: new Uint8Array([0x01, 0x00, 0x01]),  // Equivalent to 65537
   }
 };
 
 
 var keyGen = window.crypto.generateKey(algorithmKeyGen,
-                                       false, <span class="comment">// extractable</span>
+                                       false, // extractable
                                        ["sign"]);
 
 keyGen.oncomplete = function(event) {
 
-  <span class="comment">// Store the key pair in IndexedDB</span>
-  <span class="comment">// Perform a signing operation</span>
+  // Store the key pair in IndexedDB
+  // Perform a signing operation
 }
-      </code></pre></div></div>
-      <p>GB may then use a key exchange mechanism to exchange keys with the server over TLS.  This includes making sure that the client (Jae-sang) obtains a copy of GB's public key, and that GB obtains a copy of Jae-sang's public key, which were generated in the preceding step. </p>
-      <div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
-        <span class="comment">/** 
+ 
+
+      </pre>
+<p>GB may then use a key exchange mechanism to exchange keys with the server over TLS. This includes making sure that the client (Jae-sang) obtains a copy of GB's public key, and that GB obtains a copy of Jae-sang's public key, which were generated in the preceding step. </p>
+<pre class="example highlight prettyprint">
+  /** 
           TODO add some Diffie-Hellman key exchange code which results in
           1. Jae-sang having GB's public key
           2. GB having Jae-sang's public key
-          **/</span>
-         
-      </code></pre></div></div>
-      </div>
-      <p>Subsequent access to the GB website -- always over <a href="#TLS">TLS</a> -- is triggered via use of the key that Jae-sang generated when he first accessed the website.  JavaScript initially loaded by GB contains a message that only Jae-sang can decipher, since it is encrypted with his public key; moreover, that message is signed by GB, which gives the client confidence that the message originates from GB.  The message is deciphered, and the deciphered message is then digitally signed and sent back to the GB server.  This establishes identity with non-repudiation.  [<a href="#keycall">KEYCALL</a> | <a href="#verify">VERIFY</a> | <a href="#decrypt-assym">DECRYPT-ASSYM</a> | <a href="#sign">SIGN</a>].  </p>
-      <div class="example"><div class="exampleHeader">Example</div>
-       <p>In the example below, an encrypted message is signed by GB.  The signature is verified, and upon successful verfication, is decrypted.  The decrypted message is then signed and sent to GB.  This example should be seen as a simplification for illustrative purposes only, since assymetric encryption and decryption isn't recommended, and techniques such as key wrapping should be used [+<a href="#unwrap">UNWRAP</a>].</p>
-       <div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
+  **/
+</pre>  
+<p>Subsequent access to the GB website -- always over TLS -- is triggered via use of the key that Jae-sang generated when he first accessed the website. JavaScript initially loaded by GB contains a message that only Jae-sang can decipher, since it is encrypted with his public key; moreover, that message is signed by GB, which gives the client confidence that the message originates from GB. The message is deciphered, and the deciphered message is then digitally signed and sent back to the GB server. </p>
+<p>  [<a title="keycall">KEYCALL</a> | <a title="verify">VERIFY</a> | <a title="decrypt-assym">DECRYPT-ASSYM</a> | <a title="sign">SIGN</a>]</p>  
+<p>In the example below, an encrypted message is signed by GB. The signature is verified, and upon successful verfication, is decrypted. The decrypted message is then signed and sent to GB. This example should be seen as a simplification for illustrative purposes only. </p>  
+<pre class="example highlight prettyprint">
 
-        <span class="comment">// Message generated by GB... the ellipsis are added. </span>
+        // Message generated by GB... the ellipsis are added. 
         var cat = "qANQR1DBw04Dk2uPpEjcJT8QD/0VCfFK2XDM5Cg4iTRwmXrB+Pp8SMK5x09WkYqc... ";
 
-        <span class="comment">/** 
+        /** 
           1. Generate an ArrayBufferView of the overall message.
           2. Bit-manipulate this with the ArrayBufferView API to obtain the portion of bytes 
           constituting the signature as an ArrayBufferView, and the message as an ArrayBufferView.
           3. Obtain the public key of GB from IndexedDB -- pubGBKeySign -- a step not shown here.
           4. Verify the signature ... assume GB provides a method getSignature() to obtain a signature
              from the server against which the message's signature can be verified.
-          **/</span>
+          **/
 
         var data = createArrayBufferView(cat);
         var signature = extractSignature(data);
@@ -213,7 +174,7 @@
         };
         verifier = window.crypto.verify(mRSARFC3447, pubGBKeySign, signature);
         verifier.oncomplete = function(e){
-        <span class="comment">/* 
+        /* 
           If verified, obtain a prvKeyEncrypt from IndexedDB representing Jae-sang's private key and:
           1. Decrypt the message.  Note that here, typically the encryption key might be symmetric
              and wrapped.  This sample simplifies this by not demonstrating key wrapping.
@@ -221,7 +182,7 @@
           3. Send it back
           Else the signature is invalid -- abort
         */
-        </span>
+        
           if (e.target.result == true)
           {
             var decrypter = window.crypto.decrypt("RSAES-PKCS1-v1_5", prvKeyEncrypt);
@@ -230,93 +191,75 @@
             decrypter.oncomplete = function(evt)
             { 
 
-            <span class="comment">// If successfully decrypted send a signed version back</span>
+            // If successfully decrypted send a signed version back
 
             message = evt.target.result;
 
-            <span class="comment">/* Assume key retrieval code from IndexedDB that results in pubKeySign */</span>
+            /* Assume key retrieval code from IndexedDB that results in pubKeySign */
         
             var signer = window.crypto.sign(mRSARFC3447, pubKeySign, message);
             signer.onprogress = function(e){e.target.finish();}
             signer.oncomplete = function(evt)
             {
-            <span class="comment">/* 
+            /* 
                                      Combine signature and signed data into an ArrayBuffer
                                      Use XHR to send signed data back...
                                      Wait for auth token...
-                                  */ </span>
+                                  */ 
             }
         }
         else
         {
-          <span class="comment">// Unverified signature -- ABORT </span>
+          // Unverified signature -- ABORT 
         }
       }
-       </code></pre></div></div>
-      </div>
+</pre>
+<p>
+His browser presents this key every time he accesses the website and enters his password, which effectively binds his username and password to the generated private key. Additionally, Jae-sang can digitally sign online checks, authorize payments, and sign tax forms that he submits to the bank site using this generated key [SIGN]. He can also perform the following tasks, following an authentication cycle such as the one described above:</p>
+<ol>
+  <li>Receive encrypted documents from GB that only he can read, with the assurance that they have come from GB and only GB. These include his private bank statements and tax documents, which are signed with his public key, already obtained in a previous step. [<a title="verify">VERIFY</a> | <a title="unwrap">UNWRAP</a> | <a title="decrypt-sym">DECRYPT-SYM</a>]</li>
+  <li>Submit documents to GB that only GB can read, with the assurance that these have come from Jae-sang. Such documents include confidential financial information, and may be encrypted at submission. [<a title="sign">SIGN</a> | <a title="derive-sym">DERIVE-SYM</a> | <a title="encrypt-sym">ENCRYPT-SYM</a> | <a title="wrap">WRAP</a>]</li>
+</ol>
+     </section>
+<section>
+  <h2>Authenticated Video Services</h2>
+      <p>A Video Service Provider wishes to distribute high quality commercial video to users of web-enabled TVs and Set Top Boxes. The video in question can only be delivered to devices with certain capabilities that meet the service provider's security requirements, which may vary based on the content and content quality to be delivered. In order to determine whether the device is indeed approved to be used with the video service, the service provider arranges for suitable devices to each be pre-provisioned with a cryptographic key and associated identifier by the device manufacture, which are made known to the service provider.</p>
+<p>
+Ryan has just bought a new TV and wishes to watch video content from the service provider. He connects the TV to the Internet, and navigates to the video provider's website. The video provider's site establishes a secure communication channel between the video provider's page on the TV and the video provider's servers, proving to the servers that Ryan's TV is indeed one of those that meets the security requirements by use of the cryptographic key and identifier pre-provisioned on the TV. The video provider's page on the TV likewise verifies that it is talking to a genuine server, preventing the hijacking of Ryan's video watching by a malicious third party. To ensure the highest security, the pre-provisoned key is used minimally in this process to deliver session keys.
+</p>
 
-      <p>His browser presents this key every time he accesses the website and enters his password, which effectively binds his username and password to the generated private key.  Additionally, Jae-sang can digitally sign online checks, authorize payments, and sign tax forms that he submits to the bank site using this generated key [<a href="#sign">SIGN</a>]. He can also perform the following tasks, following an authentication cycle such as the one described above:</p>
-      <ol>
-        <li><p>Receive encrypted documents from GB via HTTP that only he can read, with the assurance that they have come from GB and only GB.  These include his private bank statements and tax documents, which are signed with his public key, already obtained in a previous step. [<a href="#verify">VERIFY</a> | <a href="#unwrap">UNWRAP</a>| <a href="#decrypt-sym">DECRYPT-SYM</a> ].</p></li>
-        <li><p>Submit documents to GB that only GB can read, with the assurance that these have come from Jae-sang.  Such documents include confidential financial information, and may be encrypted at submission. [<a href="#sign">SIGN</a> | <a href="#derive-sym">DERIVE-SYM</a> | <a href="#encrypt-sym">ENCRYPT-SYM</a> | <a href="#wrap">WRAP</a>]</p></li> 
-      </ol>
-      <p>If GB wishes to "cache" aspects of reusuable authentication code, but cannot avail of a code signing system, GB can employ a similar data integrity mechanism that the <a href="#data-integrity">social networking site uses</a>.  Moreover, Jae-sang or GB may at any time reinitiate a key generation operation for subsequent transactions; GB will determine the validity of the keys in question.</p>
-    </div>
-    <div id="video-service" class="section">    
-      <h3>3.2. Video Services</h3>
-<p>A Video Service Provider wishes to distribute high quality commercial video to users of web-enabled TVs and Set Top Boxes. The video in question can only be delivered to devices with certain capabilities that meet the service provider's security requirements, which may vary based on the content and content quality to be delivered. In order to determine whether the device is indeed approved to be used with the video service, the service provider arranges for suitable devices to each be pre-provisioned with a cryptographic key and associated identifier by the device manufacture, which are made known to the service provider.</p>
-
-<p>Ryan has just bought a new TV and wishes to watch video content from the service provider. He connects the TV to the Internet, and navigates to the video provider's website. The video provider's site establishes a secure communication channel between the video provider's page on the TV and the video provider's servers, proving to the servers that Ryan's TV is indeed one of those that meets the security requirements by use of the cryptographic key and identifier pre-provisioned on the TV. The video provider's page on the TV likewise verifies that it is talking to a genuine server, preventing the hijacking of Ryan's video watching by a malicious third party. To ensure the highest security, the pre-provisoned key is used minimally in this process to deliver session keys.</p> <p>[<a href="#namedkey">NAMEDKEY</a> | <a href="#verify">VERIFY</a> | <a href="#unwrap">UNWRAP</a> | <a href="#mac">MAC</a> | <a href="#encrypt-sym">ENCRYPT-SYM</a> | <a href="#decrypt-sym">DECRYPT-SYM</a> | <a href="#sign">SIGN</a>]</p>
-<div class="example"><div class="exampleHeader">Example</div>
-<p>The <a href="#KeyDiscovery">Key Discovery API</a> describes the provides a mechanism for an application in JavaScript to detect the presence of a pre-provisioned key using the name of a disclosed identifier.  </p>
-<div class="ednote"><div class="ednoteHeader">Editorial note</div><p>While <code>KeyOperation</code> is asynchronous and event driven, the key retrieval mechanism is synchronous; this might change in subsequent drafts.</p></div>
-<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
+<p>[<a title="namedkey">NAMEDKEY</a> | <a title="verify">VERIFY</a> | <a title="unwrap">UNWRAP</a> | <a title="mac">MAC</a> | <a title="encrypt-sym">ENCRYPT-SYM</a> | <a title="decrypt-sym">DECRYPT-SYM></a> | <a title="sign">SIGN</a>]</p>
+<p>The Key Discovery API describes the provides a mechanism for an application in JavaScript to detect the presence of a pre-provisioned key using the name of a disclosed identifier. </p>
+<pre class="example highlight prettyprint">
 var keys = window.getKeysByName("VetFlxL33t_Device.p1a.b11");
 keys.onerror = function(e){
   fail("This device is not authorized for Video Service Provider videos.");
   }
 keys.oncomplete = function(e){
   if(e.target.result.name == "VetFlxL33t_Device.p1a.b11"){
-  <span class="comment">// Perform further crypto operations</span>
-  <span class="comment"> ... </span>
+  // Perform further crypto operations
+   ... 
   }
 }
-</code></pre></div></div>
-</div>
-<p>Ryan creates an account with the service provider and signs up for the lowest level of service, which enables him to connect five devices to the service at any one time.  Ryan's account creation involved the creation of a specific key pair to uniquely identify him. [<a href="#derive-assym">DERIVE-ASSYM</a> | <a href="#keyex">KEYEX</a> | <a href="#keycall">KEYCALL</a> | <a href="#namedkey">NAMEDKEY</a> | <a href="#sign">SIGN</a> ]</p>
-<p>
-The video service provider is able to track the number of devices Ryan has connected to the service by virtue of the pre-provisioned keys and identifiers, so that when he attempts to connect a sixth device, the service can prompt him to upgrade his service level or deactivate one of the existing devices. [<a href="#keycall">KEYCALL</a> | <a href="#namedkey">NAMEDKEY</a>]</p>
-<p>
-Ryan finally attempts to play some video through the service. By virtue of the secure connection, the video service provider is able to make content authorization decisions that are tailored to the security capabilities of the exact make, model and version of TV that Ryan has purchased, thereby ensuring that the content providers security requirements are met in respect of the specific content requested.  Ryan's devices send encrypted messages about quality of service and watching behavior to the video service provider. [<a href="#namedkey">NAMEDKEY</a> | <a href="#keycall">KEYCALL</a> | <a href="#sign">SIGN</a> | <a href="#verify">VERIFY</a> | <a href="#mac">MAC</a> | <a href="#wrap">WRAP</a> | <a href="#encrypt">ENCRYPT</a>]</p>
-</div>
-    <div id="data-integrity" class="section">
-      <h3>3.3. Code Sanctity and Bandwidth Saver</h3>
-      <p>A major social networking site wishes to optimize website performance by storing JavaScript and other resources in local storage, preventing a needless server roundrip.  The social network site wishes to verify that these resources have not been tampered with; the service uses <a href="#localStorage"><code>localStorage</code></a> and <a href="#IndexedDB"><code>IndexedDB</code></a> to store assets for their web pages, notably JavaScript.  </p>
-      <div class="example"><div class="exampleHeader">Example</div>
-      <p>This illustrates current practice, in which <code>localStorage</code> is used to store assets locally.  Normally, the social networking site deploys code of the sort below, which a user's browser runs everytime he logs into the social networking site.</p>
-      <div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
-      function init() {
-      var src = window.localStorage.getItem('src');
-      <span class="comment">// up until now env is safe</span>
-      if (src) {
-      <span class="comment">  // now whatever code was in src will be executed</span>
-        JSON.parse(src);
-      } else {
-        <span class="comment">// fetch the code using xhr, populate localStorage</span>
-        <span class="comment">// with it. Execute it.</span>
-      }
-    }
-      </code></pre></div></div>
-      <p>Using the WebCrypto API, the social networking site might do something like this:</p>
-      <div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
-      <span class="comment">// Synchronously retrieve a SHA-256 digest of the pristine version of the code</span>
-      <span class="comment">// This is retrieved from the server</span>
-        var src_hash = getHashFromServer();
+</pre>
+
+<p>Ryan creates an account with the service provider and signs up for the lowest level of service, which enables him to connect five devices to the service at any one time. Ryan's account creation involved the creation of a specific key pair to uniquely identify him. [<a title="derive-asym">DERIVE-ASSYM</a> | <a title="keyex">KEYEX</a> | <a title="keycall">KEYCALL</a> | <a title="sign">SIGN</a> | <a title="verify">VERIFY</a>]</p>
+<p>The video service provider is able to track the number of devices Ryan has connected to the service by virtue of the pre-provisioned keys and identifiers, so that when he attempts to connect a sixth device, the service can prompt him to upgrade his service level or deactivate one of the existing devices. [<a title="keycall">KEYCALL</a> | <a title="namedkey">NAMEDKEY</a>]</p>
+<p> Ryan finally attempts to play some video through the service. By virtue of the secure connection, the video service provider is able to make content authorization decisions that are tailored to the security capabilities of the exact make, model and version of TV that Ryan has purchased, thereby ensuring that the content providers security requirements are met in respect of the specific content requested. Ryan's devices send encrypted messages about quality of service and watching behavior to the video service provider. [<a title="namedkey">NAMEDKEY</a> | <a title="keycall">KEYCALL</a> | <a title="sign">SIGN</a> | <a title="verify">VERIFY</a> | <a title="mac">MAC</a> | <a title="wrap">WRAP</a> | <a title="encrypt">ENCRYPT</a>]</p>
+</section>
+<section>
+  <h2>Code Sanctity and Bandwidth Saver</h2>
+<p>A major social networking site wishes to optimize website performance by storing JavaScript libraries that are served from a CDN in <code>localStorage</code> or in <code>IndexedDB</code>, preventing server rountrips to the CDN.  When the code in the libraries has undergone critical modifications, the social networking site wishes to determine whether the version stored in the client needs updating.  </p>
+<p>Using the Web Crypto API, the social networking site might verify a digest of the code from the CDN and compare it to a digest of the code in <code>localStorage</code>.</p>
+<pre class="example highlight prettyprint">
+// Synchronously retrieve a SHA-256 digest of the pristine version of the code
+      // This is retrieved from the server
+        var src_hash = getHashFromCDN();
         function init()
         {
           var src = window.localStorage.getItem('src');
 
-          <span class="comment">/*  Create a Digester and compare 
+          /*  Create a Digester and compare 
 
             1. Assume utility function createArrayBufferView that creates an ArrayBufferView of the src
             (and note that the comparison does depend on this being consistent on client and server).
@@ -327,7 +270,7 @@
             is terse for readability.
 
             */
-          </span>
+          
 
           bufferData = createArrayBufferView(src);
           var digest = window.crypto.digest("SHA-256", bufferData);
@@ -340,31 +283,27 @@
             }
             else
             {
-                <span class="comment">// Fetch the code using XHR and repopulate localStorage</span>
+                // Fetch the code using XHR and repopulate localStorage
             }
           }
         }
-
-      </code></pre></div></div>
-      <p>In this case, <code>getHashFromServer()</code> is runs within the origin of the page of the social networking site, within TLS.</p>
-    </p>
-    <div class="note"><div class="noteHeader">Note</div><p>The conversion to an <a href="#TypedArray"><code>ArrayBufferView</code></a> must be consistent with the conversion to bits on the server side, so that the SHA-256 digests can be compared acurately.</p></div>
-      </div>
-
+<div class="note">The conversion to an <code>ArrayBufferView</code> must be consistent with the conversion to the bits on the server-side, so that the SHA-256 digests can be compared accurately.</div>
+</pre>
+<p>In this case, <code>getHashFromServer()</code> runs within the origin of the page of the social networking site, accessed through TLS.</p>
 <ol>
-  <li><p>As in the example above, the social network can generate a digest of the material extracted from the client storage, and compare this to a pristine version of the digest that the social networking site makes available to the client. If the two digests match, the code is deemed safe. [<a href="#digest">DIGEST</a>]</p></li>
-  <li><p>They can improve on the model above by "signing with an HMAC" (or "signed hash") and then verifying the HMAC. This model offers one level more robustness, since the verification occurs within the WebCrypto API, as opposed to within the application.  [<a href="#sign">SIGN</a> | <a href="#hmac">HMAC</a> | <a href="#verify">VERIFY</a>]</p></li>
+<li>As in the example above, the social network can generate a digest of the material extracted from the client storage, and compare this to a pristine version of the digest that the social networking site makes available to the client. If the two digests match, the code is deemed safe. [<a title="digest">DIGEST</a>]</li>
+<li>They can improve on the model above by "signing with an HMAC" (or "signed hash") and then verifying the HMAC. This model offers one level more robustness, since the verification occurs within the WebCrypto API, as opposed to within the application. [<a title="sign">SIGN</a> | <a title="hmac">HMAC</a> | <a title="verify">VERIFY</a>]</li>
 </ol>
-  </div>
-   <div id="encryptedWebMail" class="section">
-    <h3>3.4. Encrypted Communications via Webmail</h3>
-    <p>Tantek wishes to communicate with Ryan securely.  Moreover, Tantek wishes to use an email web application (EWA) provided by a third party, which is a web site that allows users who have accounts to set up email accounts of their own choosing -- that is, users can enter in existing POP/IMAP/SMTP username and password credentials, or simply use an email address provided by the EWA at its own address.  The EWA serves to send messages, as well as provide a message store available from anywhere.  It allows for the possibility of sending encrypted messages.</p>
-    <p>Ryan provides a PGP key on his website, encoded in the relevant conventions.  For instance, he follows the common practice of including a Base64 text string that represents his public key.</p>
-    <div class="example"><div class="exampleHeader">Example</div>
-      <p>Ryan uses the <a href="#hcard">hCard</a> format to encapsulate contact information with some semantic annotation within the markup of his webpage.  Within the <a href="#hcard">hCard</a>, he does something like this:</p>
-      <div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
 
-&lt;span class="key"&gt;
+</section>
+<section>
+  <h2>Encrypted Communications via Webmail</h2>
+  <p>Tantek wishes to communicate with Ryan securely. Moreover, Tantek wishes to use an email web application (EWA) provided by a third party, which is a web site that allows users who have accounts to set up email accounts of their own choosing -- that is, users can enter in existing POP/IMAP/SMTP username and password credentials, or simply use an email address provided by the EWA at its own address. The EWA serves to send messages, as well as provide a message store available from anywhere. It allows for the possibility of sending encrypted messages.</p>
+  <p>Ryan provides a PGP key on his website, encoded in the relevant conventions. For instance, he follows the common practice of including a Base64 text string that represents his public key.</p>
+  <p>Ryan uses the [hCard] format to encapsulate contact information with some semantic annotation within the markup of his webpage. Within the [hCard], he does something like this:</p>
+  <pre class="example highlight prettyprint">
+    
+    &lt;span class="key">
 -----BEGIN PGP PUBLIC KEY BLOCK-----
 Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
 Comment: GPGTools - http://gpgtools.org
@@ -372,19 +311,17 @@
 nQENBE4sjPMBCAC0ublKDnsdwD9B71bygmwVxn3hX6zw4H1Qlc6wPc0/OepjqVyq
 ...
 -----END PGP PUBLIC KEY BLOCK-----
-&lt;/span&gt;
-      </code></pre></div></div>
-<p>The ellipsis have been added for brevity.</p>
-    </div>
-<p>Logging on to EWA, Tantek is prompted to import Ryan's contact information from his web page, and is notified that Ryan's public key will also be imported.  EWA then begins the process of importing Ryan's PGP key, since it understands how to parse public keys within <a href="#hcard">hCard</a> content (see also <a href="#keyexamples">key examples</a>).  In order to import the key for storage under EWA's origin, it must first "scrub" the key format to be in one of the accepted import formats of the <a href="#WebCrypto">WebCrypto API</a>.</p>
-<div class="example"><div class="exampleHeader">Example</div>
-<p>Here, the Contacts API [cf. <a href="#MozillaContacts">Mozilla</a>][cf. <a href="#GoogleContacts">Google</a>][cf. <a href="#DAPContacts">DAP</a>] could be used to procure Ryan's contact information, and can be one way of importing the key for use by an application such as EWA.  Due the same origin policy [cf. <a href="#HTML">HTML</a>], EWA must import the key, so that operations conducted with it fall under the domain of EWA.  Convert the key to <a href="#JWK">JSON Web Key</a> format, which the <a href="#WebCrypto">WebCrypto API</a> accepts if converted to octets, and then import it for use within the web application.</p>
-<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
-<span class="comment">/**
+&lt;/span>
+  
+</pre>
+<p>Logging on to EWA, Tantek is prompted to import Ryan's contact information from his web page, and is notified that Ryan's public key will also be imported. EWA then begins the process of importing Ryan's PGP key, since it understands how to parse public keys within hCard content (see also key examples). In order to import the key for storage under EWA's origin, it must first "scrub" the key format to be in one of the accepted import formats of the WebCrypto API.</p>
+<p>Here, the Contacts API [cf. Mozilla][cf. Google][cf. DAP] could be used to procure Ryan's contact information, and can be one way of importing the key for use by an application such as EWA. Due the same origin policy [cf. HTML], EWA must import the key, so that operations conducted with it fall under the domain of EWA. Convert the key to JSON Web Key format, which the WebCrypto API accepts if converted to octets, and then import it for use within the web application.</p>
+<pre class="example highlight prettyprint">
+/**
   1. First convert the PGP key format into an "importable" format by the WebCrypto API; assume "keyString" is the PGP format
-     Utility functions are assumed here as well.
+     Utility functions are assumed here as well. JWK by JOSE is supported format.
   2. Import the key using the WebCrypto API
-  **/</span>
+  **/
 
 var alg = "RSA";
 
@@ -392,7 +329,7 @@
 
 var jwkKeyObject = JSON.parse(jwkKey);
 
-<span class="comment">// Convert to ArrayBufferView</span>
+// Convert to ArrayBufferView
 var octetsKey = mByteArray(jwkKey);
 
 
@@ -401,90 +338,50 @@
 importer.oncomplete() = function(evt){
   var keyImported = evt.target.result;
 
-  <span class="comment">/**
+  /**
     1. Store the new object keyImported in IndexedDB
     2. The Key ID used to store the public key may be Ryan's contact
     3. Or it could be jkwKeyObject.kid
-    **/</span>
+    **/
 }
-</code></pre></div></div>
-</div>
-<p>Following the key import and storage sequence, the key now serves as a key within the origin of EWA.  EWA can then offer Tantek the option of encrypting messages to Ryan, which may follow the pattern below:</p>
+
+</pre>
+<p>Following the key import and storage sequence, the key now serves as a key within the origin of EWA. EWA can then offer Tantek the option of encrypting messages to Ryan, which may follow the pattern below:</p>
 <ol>
   <li>Tantek composes a message that he wishes to send only to Ryan.</li>
-  <li>EWA generates a symmetric key on Tantek's behalf, and uses Ryan's public key, just imported, to wrap that key.  [<a href="#derive-sym">DERIVE-SYM</a> | <a href="#keycall">KEYCALL</a> | <a href="#wrap">WRAP</a>].</li>
-  <li>EWA then signs the encrypted message and wrapped key, and sends them from Tantek's email account on Tantek's behalf [<a href="#sign">SIGN</a> | <a href="#encrypt-sym">ENCRYPT-SYM</a>].</li>
-  <li>Ryan also logs into EWA.  Separately, he has also imported Tantek's public key to EWA using a similar mechanism that Ryan did.  In this case, as long as Ryan has Tantek's public key, he does not strictly need to log into the same EWA as Tantek does; instead, Ryan may choose another email web application with a different origin, but with similar functionality, such that the public key is imported to be used within the origin of the web application.  Ryan receives the message, verifies that it is indeed from Tantek, decrypts and reads the message using his corresponding private key. [<a href="#keycall">KEYCALL</a> | <a href="#verify">VERIFY</a> | <a href="#unwrap">UNWRAP</a> | <a href="#decrypt-sym">DECRYPT-SYM</a>].</li>
-</ol>  
-<div class="note"><div class="noteHeader">Note</div><p>The use case above contains some risk; unless the source and provenance of keys are understood and trusted, the model above for "across the web" key importing lends itself to abuse by malicious users.</p></div>
-   </div>
-  <div id="realtime-messaging" class="section">
-    <h3>3.5. Off The Record Real Time Messaging</h3>
-    <p>David and Nadim wish to have an "Off The Record" chat in real time, completely between them, primarily using text, as well as the ability to share digital data such as photographs.  They log on to a chat server, and connect to each other's machines directly.  The server merely serves up the UI for the chat client, and does not log their conversation (and in fact, cannot).  The respective web pages on David and Nadim's browsers may use the <a href="#WebCrypto">WebCrypto API</a> to do the following things:</p>
-    <ol>
-      <li><p>Generate assymetric keys for David and Nadim respectively, such that both get public and private keys.  [<a href="#derive">DERIVE</a>]</p></li>
-      <li><p>Engage in a key exchange, so that David and Nadim get each other's public keys. It is conceivable that using the WebCrypto API the chat application can enable David and Nadim to use a Diffie-Hellman key exchange, or a mechanism such as SIGMA [cf.<a href="#OTR">OTR</a>] over <code>WebSocket</code>s [cf. <a href="#HTML">HTML</a>].  The key exchange which accompanies message exchanges involves the generation of cryptographically secure random numbers.  [<a href="#random">RANDOM</a> | <a href="#keyex">KEYEX</a> | <a href="#keyex-dh">KEYEX-DH</a>]</p></li>
-      <li><p>David or Nadim may now compose a message to each other.  Each message exchange involves authentication, message authentication codes, further key derivation, and further key exchanges. [<a href="#sign">SIGN</a> | <a href="#verify">VERIFY</a> | <a href="#mac">MAC</a> | <a href="#random">RANDOM</a> | <a href="#derive">DERIVE</a> | <a href="#keyex">KEYEX</a> | <a href="#keyex-dh">KEYEX-DH</a>] </p></li>
-    </ol>
-   <div class="ednote"><div class="ednoteHeader">Editorial note</div><p>This use case needs additional details.</p></div>
-  </div>
-  <div id="savemystuff" class="section">
-    <h3>3.6. Documents In the Cloud</h3>
-    <p>Vijay wishes to confidentially store certain documents of various file types using a web service that he pays a monthly subscription to for such confidential storage.  The confidential storage web application (abbreviated "SWA") makes the claim that all storage is encrypted, and that even it cannot access the contents of what a user stores.  He can drag and drop content from his laptop onto a web page of the service, and it automatically encrypts it and stores it in an encrypted manner.  Vijay can do the following:</p>
-    <ol>
-      <li><p>Log on to the service using his credentials; after the service determines that Vijay is using his primary browser, which he will use to access the service subsequently, it generates both signature and encryption key pairs. Derivation may be similar to the <a href="#banking">banking use case</a>. [<a href="#derive-assym">DERIVE-ASSYM</a> | <a href="#keyex-dh">KEYEX-DH</a> | <a href="#verify">VERIFY</a> | <a href="#unwrap">UNWRAP</a> | <a href="#decrypt-sym">DECRYPT-SYM</a> | <a href="#sign">SIGN</a>] </p></li>
-      <li><p>Drag over content from his underlying file system that he wishes to store. The SWA encrypts the content, and uploads it.  It may make multipart cryptographic operations on a given file, and it may also "chunk upload" large content, depending on file-size.  [<a href="#sign">SIGN</a> | <a href="#hmac">HMAC</a> | <a href="#derive-sym">DERIVE-SYM</a> | <a href="#encrypt-sym">ENCRYPT-SYM</a> | <a href="#keycall">KEYCALL</a> | <a href="#wrap">WRAP</a>] </p>
-<div class="example"><div class="exampleHeader">Example</div>
-<p>Multipart cryptographic operations can be performed with the same key.</p>
-<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">
-<span class="comment">// TODO: Demonstrate multi-part cryptographic operations</span>
-</code></pre></div></div>
-</div>
-</li>
-    
-      <li><p>Store that content on the server, with the assurance that it is stored there in a way that is virtually undecipherable to third-parties, including those running the SWA.</p></li>
-      <li><p>Later, Vijay can retrieve the content, and save it back to his local file system. He has the assurance that the content has not been tampered with since it was stored, and that it in fact is from SWA. [<a href="#keycall">KEYCALL</a> | <a href="#verify">VERIFY</a> | <a href="#hmac">HMAC</a> | <a href="#unwrap">UNWRAP</a> | <a href="#decrypt-sym">DECRYPT-SYM</a>] </p></li>
-    </ol>
-  </div>
- </div>
- <div id="references" class="section">
-  <h2>4. References</h2>
-<dl class="bibliography">
-  <dt id="WebCrypto">Web Cryptography API</dt>
-  <dd><cite><a href="http://www.w3.org/TR/WebCryptoAPI/">Web Cryptography API</a></cite>, D. Dahl, R. Sleevi. W3C</dd>
-  <dt id="KeyDiscovery">WebCrypto Key Discovery API</dt>
-  <dd><cite><a href="http://www.w3.org/TR/webcrypto-key-discovery/">WebCrypto Key Discovery</a></cite>, M. Watson. W3C</dd>
-  <dt id="localStorage">Web Storage</dt>
-  <dd><cite><a href="http://dev.w3.org/html5/webstorage/">Web Storage</a></cite>, I. Hickson. W3C</dd>
-  <dt id="IndexedDB">IndexedDB</dt>
-  <dd><cite><a href="http://www.w3.org/TR/IndexedDB/">Indexed Database API</a></cite>, N. Mehta, J. Sicking, E. Graff, A. Popescu, J. Orlow. W3C</dd>
-  <dt id="TypedArray">Typed Array Specification</dt>
-  <dd><cite><a href="http://www.khronos.org/registry/typedarray/specs/latest/">Typed Array Specification, Editor's Draft</a></cite>, D. Herman, K. Russell. W3C</dd>
-  <dt id="TLS">TLS</dt>
-  <dd><cite><a href="http://tools.ietf.org/html/rfc5246">The Transport Layer Security (TLS) Protocol</a></cite>, T. Dierks, E. Rescorla. W3C</dd>
-  <dt id="OTR">OTR</dt>
-  <dd><cite><a href="http://www.cypherpunks.ca/otr/Protocol-v3-4.0.0.html">Off-the-Record Messaging Protocol version 3</a></cite>, cypherpunks.ca</dd>
-  <dt id="hcard">hCard</dt>
-  <dd><cite><a href="http://microformats.org/wiki/hcard">hCard</a></cite>, T. Celik, B. Suda. microformats.org</dd>
-  <dt id="keyexamples">Microformats Key Examples</dt>
-  <dd><cite><a href="http://microformats.org/wiki/key-examples">Key Examples</a></cite>, T. Celik. microformats.org</dd>
-  <dt id="JWK">JSON Web Key</dt>
-  <dd><cite><a href="https://datatracker.ietf.org/doc/draft-ietf-jose-json-web-key/">JSON Web Key (JWK) draft-ietf-jose-json-web-key-07</a></cite>, M. Jones. IETF</dd>
-  <dt id="GoogleContacts">Google Contacts API</dt>
-  <dd><cite><a href="https://developers.google.com/google-apps/contacts/v3/">Google Contacts API v. 3.0</a></cite>, Google</dd>
-  <dt id="MozillaContacts">Mozilla Contacts API</dt>
-  <dd><cite><a href="https://wiki.mozilla.org/WebAPI/ContactsAPI">Mozilla Proposed Contacts API</a></cite>, Mozilla</dd>
-  <dt id="DAPContacts">Pick Contacts Intent</dt>
-  <dd><cite><a href="http://www.w3.org/TR/contacts-api/">Pick Contacts Intent</a></cite>R. Tibbett, R. Berjon. W3C</dd>
-  <dt id="HTML">HTML</dt>
-  <dd><cite><a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/network.html">HTML Living Standard</a></cite>, I. Hickson. WHATWG</dd>
-</dl>
+  <li>EWA generates a symmetric key on Tantek's behalf, and uses Ryan's public key, just imported, to wrap that key. [<a title="derive-sym">DERIVE-SYM</a> | <a title="keycall">KEYCALL</a> | <a title="wrap">WRAP</a>].</li>
+  <li>EWA then signs the encrypted message and wrapped key, and sends them from Tantek's email account on Tantek's behalf [<a title="sign">SIGN</a> | <a title="encrypt-sym">ENCRYPT-SYM</a>].</li>
+  <li>Ryan also logs into EWA. Separately, he has also imported Tantek's public key to EWA using a similar mechanism that Ryan did. In this case, as long as Ryan has Tantek's public key, he does not strictly need to log into the same EWA as Tantek does; instead, Ryan may choose another email web application with a different origin, but with similar functionality, such that the public key is imported to be used within the origin of the web application. Ryan receives the message, verifies that it is indeed from Tantek, decrypts and reads the message using his corresponding private key. [<a title="keycall">KEYCALL</a> | <a title="verify">VERIFY</a> | <a title="unwrap">UNWRAP</a> | <a title="decrypt-sym">DECRYPT-SYM</a>].</li>
+</ol>
+<div class="note">Importing keys from across the web is safest when the provenance of the keys is known.</div>
+</section>
+<section>
+  <h2>Off The Record Real Time Messaging</h2>
+  <p>David and Nadim wish to have an "Off The Record" chat in real time, completely between them, primarily using text, as well as the ability to share digital data such as photographs. They log on to a chat server, and connect to each other's machines directly. The server merely serves up the UI for the chat client, and does not log their conversation (and in fact, cannot). The respective web pages on David and Nadim's browsers may use the WebCrypto API to do the following things:</p>
+  <ol>
+    <li>Generate assymetric keys for David and Nadim respectively, such that both get public and private keys. [<a title="derive-assym">DERIVE-ASSYM</a>]</li>
+    <li>Engage in a key exchange, so that David and Nadim get each other's public keys. It is conceivable that using the WebCrypto API the chat application can enable David and Nadim to use a Diffie-Hellman key exchange, or a mechanism such as SIGMA [cf.OTR] over WebSockets [!HTML]. The key exchange which accompanies message exchanges involves the generation of cryptographically secure random numbers. [<a title="random">RANDOM</a> | <a title="keyex">KEYEX</a> | <a title="keyex-dh">KEYEX-DH</a>]</li>
+    <li>David or Nadim may now compose a message to each other. Each message exchange involves authentication, message authentication codes, further key derivation, and further key exchanges. [<a title="sign">SIGN</a> | <a title="verify">VERIFY</a> | <a title="mac">MAC</a> | <a title="random">RANDOM</a> | <a title="derive">DERIVE</a> | <a title="keyex">KEYEX</a> | <a title="keyex-dh">KEYEX-DH</a>] </li>
+  </ol>
+</section>
+<section>
+<h2>Documents In The Cloud</h2>
+<p>Vijay wishes to confidentially store certain documents of various file types using a web service that he pays a monthly subscription to for such confidential storage. The confidential storage web application (abbreviated "SWA") makes the claim that all storage is encrypted, and that even it cannot access the contents of what a user stores. He can drag and drop content from his laptop onto a web page of the service, and it automatically encrypts it and stores it in an encrypted manner. Vijay can do the following:</p>
+<ol>
+<li>Log on to the service using his credentials; after the service determines that Vijay is using his primary browser, which he will use to access the service subsequently, it generates both signature and encryption key pairs. Derivation may be similar to the banking use case. [<a title="derive-assym">DERIVE-ASSYM</a> | <a title="keyex-dh">KEYEX-DH</a> | <a title="verify">VERIFY</a> | <a title="unwrap">UNWRAP</a> | <a title="decrypt-sym">DECRYPT-SYM</a> | <a title="sign">SIGN</a>] </li>
+<li>Drag over content from his underlying file system that he wishes to store. The SWA encrypts the content, and uploads it. It may make multipart cryptographic operations on a given file, and it may also "chunk upload" large content, depending on file-size. [<a title="sign">SIGN</a> | <a title="hmac">HMAC</a> | <a title="derive-sym">DERIVE-SYM</a> | <a title="encrypt-sym">ENCRYPT-SYM</a> | <a title="keycall">KEYCALL</a> | <a title="wrap">WRAP</a>] </li>   
+<li>Store that content on the server, with the assurance that it is stored there in a way that is virtually undecipherable to third-parties, including those running the SWA.</li>
+<li>Later, Vijay can retrieve the content, and save it back to his local file system. He has the assurance that the content has not been tampered with since it was stored, and that it in fact is from SWA. [<a title="keycall">KEYCALL</a> | <a title="verify">VERIFY</a> | <a title="hmac">HMAC</a> | <a title="unwrap">UNWRAP</a> | <a title="decrypt-sym">DECRYPT-SYM</a>] </li> 
+</ol>
 
-
-
+    </section>
+  </section>
 
- </div>
-</div>
-  
-</body>
+    <section class='appendix'>
+      <h2>Acknowledgements</h2>
+      <p>
+        Thanks to Mark Watson, Ryan Sleevi, Ben Adida, Mountie Lee, Aymeric Vitte, LuHongQian Karen, Tobie Langel, Brad Hill, Richard Barnes, David Dahl, Tantek Celik.
+      </p>
+    </section>
+  </body>
 </html>