--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/spec/auth-respec.html Wed Feb 06 14:58:53 2013 +0100
@@ -0,0 +1,1045 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>WebID-TLS</title>
+ <meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
+ <!--
+ === NOTA BENE ===
+ For the three scripts below, if your spec resides on dev.w3 you can check them
+ out in the same tree and use relative links so that they'll work offline,
+ -->
+<style type='text/css'>
+code { font-family: monospace; }
+
+span.hilite { color: red; /* font-weight: bold */ }
+
+li p { margin-top: 0.3em;
+ margin-bottom: 0.3em; }
+
+div.explanation { background-color: #ADD8E6;
+ width: 80%;
+ margin: 12px; padding: 8px; }
+div.explanation li { margin-top: 8px; }
+div.explanation dd { margin: 4px; }
+
+.adef {
+ font-family: monospace;
+ font-weight: bold;
+ color: #ff4500 !important;
+}
+
+.aref {
+ font-family: monospace;
+ font-weight: bold;
+ color: #ff4500 !important;
+}
+
+span.entity { color: red; }
+
+span.element { color: green; }
+</style>
+
+ <script src='https://www.w3.org/Tools/respec/respec-w3c-common' class='remove'></script>
+<!-- <script src='/ReSpec.js/js/respec.js' class='remove'></script> -->
+ <script class='remove'>
+ var preProc = {
+ apply: function(c) {
+ // extend the bibliography entries
+ berjon.biblio["RFC5246"] = "T. Dierks; E. Rescorla. <a href=\"http://tools.ietf.org/html/rfc5246\"><cite>The Transport Layer Security (TLS) Protocol Version 1.2</cite></a> August 2008. Internet RFC 5246. URL: <a href=\"http://tools.ietf.org/html/rfc5246\">http://tools.ietf.org/html/rfc5246</a> ";
+ berjon.biblio["RFC5746"] = "E. Rescorla, M. Ray, S. Dispensa, N. Oskov, <a href=\"http://tools.ietf.org/html/rfc5746\"><cite>Transport Layer Security (TLS) Renegotiation Indication Extension</cite></a> February 2010. Internet RFC 5246. URL: <a href=\"http://tools.ietf.org/html/rfc5746\">http://tools.ietf.org/html/rfc5746</a> ";
+ berjon.biblio["SWBP-VOCAB-PU"] = "Diego Berrueta, Jon Phipps <a href='http://www.w3.org/TR/swbp-vocab-pub/'><cite>Best Practice Recipes for Publishing RDF Vocabularies</cite></a> W3C Working Group Note 28 August 2008";
+ berjon.biblio["TURTLE-TR"] = "David Beckett, Tim Berners-Lee. <a href='http://www.w3.org/TR/turtle/'><cite>Turtle: Terse RDF Triple Language.</cite></a> W3C Working Draft 09 August 2011 URL: <a href='http://www.w3.org/TR/turtle/'>http://www.w3.org/TR/turtle/</a>";
+ berjon.biblio["FOAF"] = "Dan Brickley, Libby Miller. <a href='http://xmlns.com/foaf/0.1/'><cite>FOAF: Vocabulary Specification 0.98.</cite></a>";
+ // process the document before anything else is done
+ var refs = document.querySelectorAll('adef') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var sp = document.createElement( 'dfn' ) ;
+ var tit = item.getAttribute('title') ;
+ if (!tit) {
+ tit = con;
+ }
+ sp.className = 'adef' ;
+ sp.title=tit ;
+ sp.innerHTML = con ;
+ p.replaceChild(sp, item) ;
+ }
+ refs = document.querySelectorAll('aref') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var sp = document.createElement( 'a' ) ;
+ sp.className = 'aref' ;
+ sp.setAttribute('title', con);
+ sp.innerHTML = '@'+con ;
+ p.replaceChild(sp, item) ;
+ }
+ // local datatype references
+ refs = document.querySelectorAll('ldtref') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ if (!item) continue ;
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var ref = item.getAttribute('title') ;
+ if (!ref) {
+ ref = item.textContent ;
+ }
+ if (ref) {
+ ref = ref.replace(/\n/g, '_') ;
+ ref = ref.replace(/\s+/g, '_') ;
+ }
+ var sp = document.createElement( 'a' ) ;
+ sp.className = 'datatype';
+ sp.title = ref ;
+ sp.innerHTML = con ;
+ p.replaceChild(sp, item) ;
+ }
+ // external datatype references
+ refs = document.querySelectorAll('dtref') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ if (!item) continue ;
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var ref = item.getAttribute('title') ;
+ if (!ref) {
+ ref = item.textContent ;
+ }
+ if (ref) {
+ ref = ref.replace(/\n/g, '_') ;
+ ref = ref.replace(/\s+/g, '_') ;
+ }
+ var sp = document.createElement( 'a' ) ;
+ sp.className = 'externalDFN';
+ sp.title = ref ;
+ sp.innerHTML = con ;
+ p.replaceChild(sp, item) ;
+ }
+ // now do terms
+ refs = document.querySelectorAll('tdef') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ if (!item) continue ;
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var ref = item.getAttribute('title') ;
+ if (!ref) {
+ ref = item.textContent ;
+ }
+ if (ref) {
+ ref = ref.replace(/\n/g, '_') ;
+ ref = ref.replace(/\s+/g, '_') ;
+ }
+ var sp = document.createElement( 'dfn' ) ;
+ sp.title = ref ;
+ sp.innerHTML = con ;
+ p.replaceChild(sp, item) ;
+ }
+ // now term references
+ refs = document.querySelectorAll('tref') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ if (!item) continue ;
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var ref = item.getAttribute('title') ;
+ if (!ref) {
+ ref = item.textContent ;
+ }
+ if (ref) {
+ ref = ref.replace(/\n/g, '_') ;
+ ref = ref.replace(/\s+/g, '_') ;
+ }
+
+ var sp = document.createElement( 'a' ) ;
+ var id = item.textContent ;
+ sp.className = 'tref' ;
+ sp.title = ref ;
+ sp.innerHTML = con ;
+ p.replaceChild(sp, item) ;
+ }
+ }
+ } ;
+
+
+ var respecConfig = {
+ // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
+ // embed RDFa data in the output
+ doRDFa: true,
+ specStatus: "ED",
+ diffTool: "http://www5.aptest.com/standards/htmldiff/htmldiff.pl",
+
+ // the specifications short name, as in http://www.w3.org/TR/short-name/
+ shortName: "auth-webid",
+ subtitle: "WebID Authentication over TLS",
+
+ // if you wish the publication date to be other than today, set this
+ // publishDate: "2009-08-06",
+ copyrightStart: "2010",
+
+ // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
+ // and its maturity status
+ previousPublishDate: "2011-12-12",
+ previousMaturity: "ED",
+ previousURI: "http://www.w3.org/2005/Incubator/webid/spec/drafts/ED-webid-20111212/",
+
+
+ // if there a publicly available Editors Draft, this is the link
+ edDraftURI: "http://www.w3.org/2005/Incubator/webid/spec/drafts/ED-webid-20130206",
+
+ // if this is a LCWD, uncomment and set the end of its review period
+ // lcEnd: "2009-08-05",
+
+ // if you want to have extra CSS, append them to this list
+ // it is recommended that the respec.css stylesheet be kept
+ extraCSS: ['http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css'],
+
+ // editors, add as many as you like
+ // only "name" is required
+ editors: [
+ { name: "Henry Story",
+ mailto: "henry.story@bblfish.net",
+ url: "http://bblfish.net/" },
+ { name: "Stéphane Corlosquet",
+ mailto:"scorlosquet@gmail.com",
+ company: "Massachusetts General Hospital",
+ companyURL: "http://massgeneral.org/" },
+ { name: "Andrei Sambra",
+ mailto: "andrei@fcns.eu",
+ url: "https://my-profile.eu/people/deiu/card#me" }
+ ],
+
+ // 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: "Manu Sporny", mailto:"msporny@digitalbazaar.com",
+ company: "Digital Bazaar, Inc.", companyURL: "http://blog.digitalbazaar.com/" },
+ { name: "Toby Inkster", url: "http://tobyinkster.co.uk/" },
+ { name: "Henry Story", url: "http://bblfish.net/" },
+ { name: "Bruno Harbulot", url: "http://blog.distributedmatter.net/" }
+ ],
+
+// errata: 'http://www.w3.org/MarkUp/2008/REC-rdfa-syntax-20081014-errata',
+
+ // name of the WG
+ wg: "WebID CG",
+
+ // URI of the public WG page
+ wgURI: "http://www.w3.org/community/webid/",
+
+ // name (with the @w3c.org) of the public mailing to which comments are due
+ wgPublicList: "public-webid",
+
+ // alternate formats for this document
+ //alternateFormats: [
+ // { uri: 'http://www.w3.org/2005/Incubator/webid/spec/drafts/ED-webid-20111212/diff-20111123.html',
+ // label: "Diff from previous Editors Draft" }],
+
+ // 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: "http://www.w3.org/2004/01/pp-impl/46065/status",
+ maxTocLevel: 4,
+ preProcess: [ preProc ]
+ };
+
+
+ function updateExample(doc, content) {
+ // perform transformations to make it render and prettier
+ content = content.replace(/<!--/, '');
+ content = content.replace(/-->/, '');
+ content = doc._esc(content);
+ content = content.replace(/\*\*\*\*([^*]*)\*\*\*\*/g, '<span class="hilite">$1</span>') ;
+ return content ;
+ }
+
+ function updateDTD(doc, content) {
+ // perform transformations to
+ // make it render and prettier
+ content = '<pre class="dtd">' + doc._esc(content) + '</pre>';
+ content = content.replace(/!ENTITY % ([^ \t\r\n]*)/g, '!ENTITY <span class="entity">% $1</span>');
+ content = content.replace(/!ELEMENT ([^ \t$]*)/mg, '!ELEMENT <span class="element">$1</span>');
+ return content;
+ }
+
+ function updateSchema(doc, content) {
+ // perform transformations to
+ // make it render and prettier
+ content = '<pre class="dtd">' + doc._esc(content) + '</pre>';
+ content = content.replace(/<xs:element\s+name="([^&]*)"/g, '<xs:element name="<span class="element" id="schema_element_$1">$1</span>"') ;
+ return content;
+ }
+
+ function updateTTL(doc, content) {
+ // perform transformations to
+ // make it render and prettier
+ content = '<pre class="sh_sourceCode">' + doc._esc(content) + '</pre>';
+ content = content.replace(/@prefix/g, '<span class="sh_keyword">@prefix</span>');
+ return content;
+ }
+ </script>
+ </head>
+ <body>
+ <section id='abstract'>
+
+<p>A global distributed Social Web requires that each person be able to control their identity, that this identity be linkable across sites - placing each person in a Web of relationships - and that it be possible to authenticate globally with such identities. By making distributed authentication easy one can allow everybody to protect their resources and enable their preferred privacy settings.</p>
+<p>This specification outlines a simple universal identification mechanism that is distributed, openly extensible, improves privacy, security and control over how each person can identify themselves in order to allow fine grained access control to their information on the Web.
+It does this by applying the best practices of Web Architecture whilst building on well established widely deployed protocols and standards including HTML, URIs, HTTP, TLS, X.509 Certificates, and RDF Semantics.
+</p>
+
+<section>
+<h2>How to Read this Document</h2>
+
+<p>There are a number of concepts that are covered in this document that the
+reader may want to be aware of before continuing. General knowledge of
+<a href="http://en.wikipedia.org/wiki/Public_key_cryptography">public key cryptography</a>
+and RDF [[!RDF-PRIMER]] is necessary to understand how
+to implement this specification. WebID uses a number of specific technologies
+like HTTP over TLS [[!HTTP-TLS]], X.509 certificates [[!X509V3]],
+Turtle [[!TURTLE-TR]] and RDFa [[!RDFA-CORE]].</p>
+
+<p>A general <a href="#introduction">Introduction</a> is provided for all that
+would like to understand why this specification is necessary to simplify usage
+of the Web.</p>
+
+<p>The terms used throughout this specification are listed in the section
+titled <a href="#terminology">Terminology</a>.</p>
+
+<p>Developers that are interested in implementing this specification will be
+most interested in the sections titled
+<a href="#authentication-sequence">Authentication Sequence</a> and
+<a href="#authentication-sequence-details">Authentication Sequence Details</a>.</p>
+
+</section>
+</section>
+
+<section id='sotd'>
+<!-- <p>This document has been reviewed by W3C Members, by software
+developers, and by other W3C groups and interested parties, and is
+endorsed by the Director as a W3C Recommendation. It is a stable
+document and may be used as reference material or cited from another
+document. W3C's role in making the Recommendation is to draw attention
+to the specification and to promote its widespread deployment. This
+enhances the functionality and interoperability of the Web.</p> -->
+
+This document is produced from work by the
+<a href="http://www.w3.org/2005/Incubator/webid/">W3C WebID Incubator Group</a>.
+This is an internal draft document and may not even end up being officially
+published. It may also be updated, replaced or obsoleted by other documents
+at any time. It is inappropriate to cite this document as other than
+work in progress.
+The source code for this document is available at the following
+URI: <a href="https://dvcs.w3.org/hg/WebID">https://dvcs.w3.org/hg/WebID</a>
+
+</section>
+
+<section class='informative'>
+<h1>Introduction</h1>
+
+<p>
+The WebID protocol enables secure, efficient and maximally user friendly authentication on the Web.
+It enables people to authenticate onto any site by simply choosing one of the certificates proposed to them by their browser.
+These certificates can be created by any Web Site for their users.
+The identifier, known as the <tt>WebID</tt>, as well as the associated <tt>Profile Document</tt> have been defined in <a href="https://dvcs.w3.org/hg/WebID/raw-file/tip/spec/identity-respec.html">Web Identity and Discovery (WebID 1.0)</a> specification draft.</p>
+<p>
+WebIDs can be used to build a Web of trust using vocabularies such as [[!FOAF]] by allowing people to link together their profiles in a public or protected manner.
+Such a web of trust can then be used by a <tref>Service</tref> to make authorization decisions, by allowing access to resource depending on the properties of an agent, such that he/she is known by some relevant people, works at a given company, is a family member, is part of some group, ...</p>
+<p>
+The WebID protocol specifies how a <tref>Service</tref> can authenticate a user after requesting his or her <tref>Certificate</tref> without needing to rely on this being signed by a well known Certificate Authority. This is done by dereferencing the WebID Profile, and checking if it describes the user as being in control of the private key related to the <tref>Public Key</tref> published in the <tref>Certificate</tref> used to authenticate.
+</p>
+<p>WebID authentication can also be used for automatic authentication by robots, such as web crawlers of linked data repositories, which could be agents working on behalf of users to help them in their daily tasks. The WebID protocol is not limited to authentication on the World Wide Web, but can work with any TLS based protocol.</p>
+<section>
+<h1>Outline</h1>
+<p>This specification is divided in the following sections.</p>
+<p><a href="#introduction">This section</a> gives a high level overview of the WebID Protocol, and presents the organization of the specification and the conventions used throughout the document.</p>
+<p><a href="#preconditions">Section 2</a> lists the preconditions that need to be in place for any authentication sequence to be successful: which include the creation of a WebID Profile and the creation of a <tref>WebID Certificate</tref></p>.
+<p><a href="#the-webid-protocol">Section 3</a> on the WebID Protocol describes in detail how a server can authenticate a user.</p>
+</section>
+<section>
+<h1>Terminology</h1>
+<dl>
+<dt><tdef>Alice</tdef></dt>
+<dd>Alice is an agent who owns a Server which runs a Service which Bob wishes to Access.</dd>
+
+<dt><tdef>Bob</tdef></dt>
+<dd>Bob is an agent who uses a <tref>Client</tref> to connect to <tref>Alice</tref>'s Service, and who is responsible for the private key the <tref>Client</tref> uses to authenticate to <tref>Service</tref>s.
+If he notices the private key was compromised he needs to take action to disable the public key.
+</dd>
+<dt><tdef>Subject</tdef></dt>
+<dd>The Subject is the Agent that is identified by the WebID.
+Only the Subject should be able to authenticate to a <tref>Service</tref>.
+We will name him <tref>Bob</tref> throughout this document to improve readability.
+The Subject is distinct from the <tref>Client</tref> which is used to connect to the <tref>Server</tref>.
+</dd>
+<dt><tdef>Client</tdef></dt>
+<dd>The Client initiates a request to a Service listening on a specific port using a given protocol on a given Server. It can request authentication credentials from a <tref>Key Store</tref> to send to a server.
+</dd>
+
+<dt><tdef>Key Store</tdef></dt>
+<dd>A Key Store can return certificates to authorized <tref>Clients</tref> and can sign cryptographic tokens with the corresponding key.
+This protocol does not specify where the Key Store is located: it could be that the <tref>Client</tref> contains its own Key Store or it could be that the Key Store is a separate process on the Operating System, or even that it is to be found in an external device controlled by the <tref>Subject</tref>.
+</dd>
+
+<dt><tdef>Server</tdef></dt>
+<dd>A Server is a machine contactable at a domain name or IP address that hosts a number of globally accessible Services.</dd>
+
+<dt><tdef>Service</tdef></dt>
+<dd>A Service is an agent listening for requests at a given IP address on a given Server.</dd>
+
+<dt><tdef>TLS Service</tdef></dt>
+<dd>A TLS Service is a transport level service listening on the <tref>Service</tref> port.
+It secures the transport layer before passing messages to the Application layer <tref>Service</tref> itself.
+The TLS protocol [[!RFC5246]] is applied to incoming connections: it identifies the server to the client, securing the channel and is able to request authentication credentials from the <tref>Client</tref> if needed.
+Server Credentials and Client credentials traditionally take the form of X.509 Certificates containing a public key.
+The TLS protocol enables the TLS Service to verify that the <tref>Client</tref> controls the private key of the <tref>Public Key</tref> published in the certificate.
+Trust decisions on other attributes of the <tref>Subject</tref> published in the Certificate - such as his name - are traditionally based on the trust in the Agent that signed the Certificate - known as a <tref>Certificate Authority</tref>.
+</dd>
+<dt><tdef>Certificate</tdef><dt>
+<dd>A Certificate is a document that affirms statements about a <tref>Subject</tref> such as its <tref>public key</tref> and its name, and that is signed by a <tref>Certificate Authority</tref> using the private key that corresponds to the public key published in its certificate. The Certificate Authority's own Certificate is self signed. Certificates used by TLS are traditionally X.509 [[!X509V3]] Certificates. </dd>
+<dt><tdef>Certificate Authority</tdef> (<tdef>CA</tdef>)</dt>
+<dd>
+A Certificate Authority is a Subject that signs <tref>Certificates</tref>.
+It is an Authority for what is written in the Certificate for any Agent that trusts it to be truthful in what it signs.
+Such agents use the knowledge of the CA's public key to verify the statements made by that CA in any of the Certificates it signed.
+<tref>Service</tref>s usually identify themselves with Certificates signed by well known and widely deployed CAs available in all agents.
+</dd>
+<dt><tdef>TLS-Light Service</tdef> or <tdef>TLS Agent</tdef></dt>
+<dd>A TLS-Light Service is a standard <tref>TLS Service</tref>, without the CA Based Client Certificate Authentication.
+When receiving a Client Certificate, it simply verifies that the <tref>Client</tref> knows the private key of the public key published in the Certificate.
+Verification of attributes in the certificate is left to other services such as the <tref>WebID Verifier</tref>.
+</dd>
+
+<dt><tdef>Guard</tdef><dt>
+<dd>A Guard is an agent, usually on the <tref>Server</tref> that can look at a request from the <tref>Client</tref> and decide if it needs to be authorized by looking at the access control rules for that resource.
+If the request requires authorization, the Guard can first demand authentication of the <tref>Client</tref> and use the <tref>WebID Verifier</tref> to check any claimed identies that would allow it to come to an authorization decision.
+Finally the Guard can grant or deny access according to how the verfied identities satisfy the Access Control Rules.
+</dd>
+
+<dt><tdef>WebID Claim</tdef> or <tdef>Claimed WebID</tdef></dt>
+<dd>A <tref>WebID Certificate</tref> can be thought of as a set of statements made and signed by a <tref>Certificate Authority</tref>.
+If the Certificate Authority is not known to be one whose every statement can be trusted, then the statements in the certificate must be thought of by a suspicious guard, as claimed statements only, that is as statements which have not been verified.
+In particular, statements about the <code>Subject Alternative Name</code>s of the agent that knows the private key should not be assumed to be true until verified.
+A WebID Claim then is the statement of Identity between the <code>Subject Alternative Name</code> and the public key in the certificate.
+In Turtle this can be written as
+ <pre class="example">
+ :bob cert:key [ a cert:RSAPublicKey;
+ cert:modulus "00cb24ed85d64d794b..."^^xsd:hexBinary;
+ cert:exponent 65537 ] .
+ </pre>
+</dd>
+
+<dt><tdef>Verification Agent</tdef> or <tdef>WebID Verifier</tdef></dt>
+<dd>A WebID Verifier takes a <tref>WebID Claim</tref> and checks that it is currently true, as explained in <a href="#verifying-the-webids">Verifying the WebIDs</a> section.
+A WebID Verification Agent MUST be able to parse documents in TURTLE [[!TURTLE-TR]], RDF/XML [[!RDF-SYNTAX-GRAMMAR]] and RDFa [[!RDFA-CORE]].
+</dd>
+
+<dt><tdef>WebID Certificate</tdef></dt>
+<dd>An X.509 [[!X509V3]] <tref>Certificate</tref> that identifes an Agent using one or more WebIDs.
+The Certificate need not be signed by a well known Certificate Authority.
+Indeed it can be signed by the server which hosts the WebID Profile, or it can even be self signed.
+The Certificate MUST contain a <code>Subject Alternative Name</code> extension with at least one URI entry identifying the <tref>Subject</tref>.
+This URI SHOULD be one of the URIs with a dereferenceable secure scheme, such as https:// . Dereferencing this URI should return a representation containing RDF data.
+For example, a certificate identifying the WebID <code>https://bob.example/profile#me</code> would contain the following:
+<pre class="example">
+X.509v3 extensions:
+ ...
+ X509v3 Subject Alternative Name:
+ URI:https://bob.example/profile#me
+</pre>
+And it would have a WebID Profile at <code>https://bob.example/profile</code>.
+</dd>
+
+<dt><tdef>Public Key</tdef></dt>
+<dd>A cryptographic key that can be published and can be used to verify the possession of a private key. A public
+key is always included in a <tref>WebID Certificate</tref>.</dd>
+
+</dl>
+</section>
+
+<section class="normative">
+<h1>Namespaces</h1>
+<p>Examples assume the following namespace prefix bindings unless otherwise stated:</p>
+<table style="text-align: left; border-color: rgb(0, 0, 0); border-collapse: collapse;" border="1" cellpadding="5">
+ <thead>
+ <tr>
+ <th>Prefix</th>
+ <th>IRI</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>cert</code></td>
+ <td>http://www.w3.org/ns/auth/cert#</td>
+ </tr>
+
+ <tr>
+ <td><code>xsd</code></td>
+ <td>http://www.w3.org/2001/XMLSchema#</td>
+ </tr>
+ <tr>
+ <td><code>foaf</code></td>
+ <td>http://xmlns.com/foaf/0.1/</td>
+ </tr>
+ <tr>
+ <td><code>bob</code></td>
+ <td>https://bob.example/profile#</td>
+ </tr>
+ </tbody>
+</table>
+
+<p>The bob: namespace is a URI that refers to Bob's profile, where Bob is an imaginary character well known in security circles.</p>
+</section>
+</section>
+
+<section>
+<h1>Preconditions</h1>
+
+
+<section class='normative'>
+<h1>The certificate</h1>
+
+<p>The <tref>Key Store</tref> must have a <tref>Certificate</tref> with a <code>Subject Alternative Name</code> URI entry.
+This URI must be one that dereferences to a document the user controls so that he can publish the
+public key for that <tref>Certificate</tref> at this URI.</p>
+<p>For example, if a user Bob controls <code>https://bob.example/profile</code>,
+then his WebID can be <code>https://bob.example/profile#me</code></p>
+<p>When creating a certificate it is very important to choose a user friendly Common Name (CN) for the user, that will allow him to distinguish between different certificates he may have, such as a personal or a business certificate, when selecting one from his browser.
+In the example below the CN is <code>Bob (personal)</code>.
+This name can then also be displayed by any server authenticating the user as a human friendly label.
+The WebID URL itself should not usually be used as a visible identifier for human users, rather it should be thought of as a hyperlink in an <code><a href="https://..."></code> anchor.
+That is the CN should be a label and the WebID a pointer. </p>
+
+<p>As an example to use throughout this specification here is the
+following certificate as an output of the OpenSSL program.</p>
+<pre class="example">
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 5f:df:d6:be:2c:73:c1:fb:aa:2a:2d:23:a6:91:3b:5c
+ Signature Algorithm: sha1WithRSAEncryption
+ <span style="color: red">Issuer:</span> O=FOAF+SSL, OU=The Community of Self Signers, CN=Not a Certification Authority
+ Validity
+ Not Before: Jun 8 14:16:14 2010 GMT
+ Not After : Jun 8 16:16:14 2010 GMT
+ <span style="color: red">Subject:</span> O=FOAF+SSL, OU=The Community Of Self Signers, CN=Bob (Personal)
+ Subject Public Key Info:
+<span style="color: red"> Public Key Algorithm:</span> rsaEncryption
+ <span style="color: red">Public-Key:</span> (2048 bit)
+ <span style="color: red">Modulus:</span>
+ 00:cb:24:ed:85:d6:4d:79:4b:69:c7:01:c1:86:ac:
+ c0:59:50:1e:85:60:00:f6:61:c9:32:04:d8:38:0e:
+ 07:19:1c:5c:8b:36:8d:2a:c3:2a:42:8a:cb:97:03:
+ 98:66:43:68:dc:2a:86:73:20:22:0f:75:5e:99:ca:
+ 2e:ec:da:e6:2e:8d:15:fb:58:e1:b7:6a:e5:9c:b7:
+ ac:e8:83:83:94:d5:9e:72:50:b4:49:17:6e:51:a4:
+ 94:95:1a:1c:36:6c:62:17:d8:76:8d:68:2d:de:78:
+ dd:4d:55:e6:13:f8:83:9c:f2:75:d4:c8:40:37:43:
+ e7:86:26:01:f3:c4:9a:63:66:e1:2b:b8:f4:98:26:
+ 2c:3c:77:de:19:bc:e4:0b:32:f8:9a:e6:2c:37:80:
+ f5:b6:27:5b:e3:37:e2:b3:15:3a:e2:ba:72:a9:97:
+ 5a:e7:1a:b7:24:64:94:97:06:6b:66:0f:cf:77:4b:
+ 75:43:d9:80:95:2d:2e:85:86:20:0e:da:41:58:b0:
+ 14:e7:54:65:d9:1e:cf:93:ef:c7:ac:17:0c:11:fc:
+ 72:46:fc:6d:ed:79:c3:77:80:00:0a:c4:e0:79:f6:
+ 71:fd:4f:20:7a:d7:70:80:9e:0e:2d:7b:0e:f5:49:
+ 3b:ef:e7:35:44:d8:e1:be:3d:dd:b5:24:55:c6:13:
+ 91:a1
+ <span style="color: red">Exponent:</span> 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints: critical
+ CA:FALSE
+ X509v3 Key Usage: critical
+ Digital Signature, Non Repudiation, Key Encipherment, Key Agreement
+ Netscape Cert Type:
+ SSL Client, S/MIME
+ X509v3 Subject Key Identifier:
+ 08:8E:A5:5B:AE:5D:C3:8B:00:B7:30:62:65:2A:5A:F5:D2:E9:00:FA
+ <span style="color: red">X509v3 Subject Alternative Name:</span> critical
+ <span style="color: red">URI:</span>https://bob.example/profile#me
+ Signature Algorithm: sha1WithRSAEncryption
+ cf:8c:f8:7b:b2:af:63:f0:0e:dc:64:22:e5:8a:ba:03:1e:f1:
+ ee:6f:2c:f5:f5:10:ad:4c:54:fc:49:2b:e1:0d:cd:be:3d:7c:
+ 78:66:c8:ae:42:9d:75:9f:2c:29:71:91:5c:29:5b:96:ea:e1:
+ e4:ef:0e:5c:f7:07:a0:1e:9c:bf:50:ca:21:e6:6c:c3:df:64:
+ 29:6b:d3:8a:bd:49:e8:72:39:dd:07:07:94:ac:d5:ec:85:b1:
+ a0:5c:c0:08:d3:28:2a:e6:be:ad:88:5e:2a:40:64:59:e7:f2:
+ 45:0c:b9:48:c0:fd:ac:bc:fb:1b:c9:e0:1c:01:18:5e:44:bb:
+ d8:b8
+</pre>
+<p class="issue">Should we formally require the Issuer to be
+O=FOAF+SSL, OU=The Community of Self Signers, CN=Not a Certification Authority.
+This was discussed on the list as allowing servers to distinguish certificates
+that are FOAF+SSL enabled from others. Will probably need some very deep TLS
+thinking to get this right.</p>
+<p class="issue">The above certificate is no longer valid, as I took an valid
+certificate and change the time and WebID. As a result the signature is now
+false. A completely valid certificate should be generated to avoid nit-pickers
+picking nits.</p>
+<section class='normative'>
+<h1>Creating a Certificate</h1>
+<p>Many tools exist to create Certificates.
+Some <tref>Key Store</tref>s allow a user to create the Certificate directly with a friendly User Interface.
+But using a <tref>Key Store</tref> on the client still requires the public key to be published on the server as detailed in the next section.
+It is possible to combine the creation of the key with its publication in one step in such a way as to allow the server to make the decision of what the WebID should be, by using the <a href="http://www.w3.org/TR/html5/the-button-element.html#the-keygen-element">HTML 5 keygen</a> element.
+This element can be placed in an HTML5 form, where on submitting the form, the browser asks the <tref>Key Store</tref> to create a public and private key pair, and on receiving the public part of that key pair, the Client can send a key request as part of the form to the <tref>Service</tref>. The <tref>Service</tref> can then create a <tref>WebID Certificate</tref> and return it to the <tref>Client</tref> to pass onto the <tref>Key Store</tref>. In that way the Server is in the position to best make the decisions of what the <tref>Certificate</tref> should say and what the WebID should be without the private key ever leaving the secure <tref>Key Store</tref>. The user experience for this Certificate creation is a one click operation.
+</section>
+</section>
+
+<section class='normative'>
+<h1>Publishing the Certificate data in a WebID Profile Document</h1>
+<!-- Update the image to contain only certificate data -->
+
+<p>The WebID Profile document MUST expose the relation between the WebID URI and the <tref>Subject</tref>'s <tref>public key</tref>s using the <code>cert</code> ontology as well as the standard <code>xsd</code> datatypes.
+The set of relations to be published at the WebID Profile document can be presented in a graphical notation as follows.</p>
+<img alt="Web ID graph" width="90%" src="img/WebIdGraph.jpg"/>
+<p>The document can publish many more relations that are of interest to the WebID protocol, as shown in the above graph by the grayed out relations.
+For example Bob can publish a depiction or logo, so that sites he authenticates to can personalize the user experience. He can post links to people he knows, where those have WebIDs published on other sites, in order to create a distributed Social Web.
+He can also publish relations to protected documents, where he keeps more information for people who authenticate, such as his friend Alois or his friends friends who may not yet know him personally, such as Alice.
+</p>
+<p>
+The protocol does not depend on any particular serialization of the graph, provided that agents are able to parse that serialization and obtain the graph automatically.
+Technologies such as GRDDL [[!GRDDL-PRIMER]] for example permit any XML format to be transformed automatically to a graph of relations.
+HTTP Content Negotiation can be employed to aid in publication and discovery of multiple distinct serializations of the same graph at the same URL, as explained by the working group note <a href="http://www.w3.org/TR/2008/NOTE-swbp-vocab-pub-20080828/">Best Practice Recipes for Publishing RDF Vocabularies</a> [[!SWBP-VOCAB-PUB]]</p>
+<p class="note">
+For reasons of interoperability, in order not to overburden the implementation and testing work of <tref>WebID Verifier</tref>s, and in order to provide a seamless experience for end users, of the many formats that can be publish at one location, it is established that at present publishers MUST publish their documents as [[!TURTLE-TR]], but MAY publish them in other RDF serialization formats (e.g. [[!RDFA-CORE]]) which can then be requested through content negotiation.
+If other formats grow in popularity, are implemented by verifiers, and gain community acceptance, these can be added to the list.
+</p>
+<p>
+It is suggested that the provider uses the HTML <code><link></code> element to allow discovery of the various alternate representations of the graph which may be available:
+</p>
+
+<pre class="example">
+<html>
+<head>
+<link rel="alternate" type="application/rdf+xml" href="profile.rdf"/>
+<link rel="alternate" type="text/turtle" href="profile.ttl"/>
+...
+</head> ...
+</pre>
+<p>It is particularly useful to have one of the representations be in HTML
+even if it is not marked up in RDFa as this allows people using a
+web browser to understand what the information at that URI represents.</p>
+<section class='normative'>
+<h2>Vocabulary</h2>
+
+<p>RDF graphs are built using vocabularies defined by URIs, that can be placed in subject, predicate or object position.
+ The definition of each URI should be found at the namespace of the URI, by dereferencing it.
+ Here we list the core cryptographic terms needed, and detail some of the useful optional relations from the FOAF
+ vocabulary that we have used in the diagrams.
+</p>
+<section class='normative'>
+<h2>Cryptographic Vocabulary</h2>
+
+<p>The following properties SHOULD be used when conveying the relation between the
+ <tref>Subject</tref> and his or her key, within WebID Profile documents:</p>
+<dl>
+ <dt><a href="http://www.w3.org/ns/auth/cert#RSAPublicKey">cert:RSAPublicKey</a></dt>
+ <dd>Refers to the class of RSA public key. The RSAPublicKey MUST specify the
+ cert:modulus and cert:exponent properties.</dd>
+ <dt><a href="http://www.w3.org/ns/auth/cert#key">cert:key</a></dt>
+ <dd>Used to associate a WebID URI with an RSAPublicKey. A WebID Profile
+ MUST contain at least one RSAPublicKey that is associated with the
+ corresponding WebID URI.</dd>
+ <dt><a href="http://www.w3.org/ns/auth/cert#modulus">cert:modulus</a></dt>
+ <dd>Used to relate an RSAPublic key to its modulus expressed as a hexBinary.
+ An RSA Key must have one and only one modulus. The datatype of a modulus is xsd:hexBinary.
+ </dd>
+ <dt><a href="http://www.w3.org/ns/auth/cert#exponent">cert:exponent</a></dt>
+ <dd>Used to relate an RSAPublic key to its exponent expressed as an integer.
+ An RSA Key must have one and only one exponent. The datatype of a modulus is xsd:integer.
+ </dd>
+</dl>
+
+</section>
+
+
+
+</section>
+<section class='informative'>
+<h1>Turtle</h1>
+<p>A widely used format for writing RDF graphs by hand is the <a href="http://www.w3.org/TR/turtle/">Turtle</a> [[!TURTLE-TR]] notation.
+ It is easy to learn, and very handy for communicating over e-mail and on mailing lists.
+ The syntax is very similar to the SPARQL query language.
+ Turtle should be served with the <code>text/turtle</code> mime type.
+</p>
+<pre class="example" style="word-wrap: break-word; white-space: pre-wrap;">
+ @prefix cert: <http://www.w3.org/ns/auth/cert#> .
+ @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+ @prefix foaf: <http://xmlns.com/foaf/0.1/> .
+ @prefix rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+ <#me> a foaf:Person;
+ foaf:name "Bob";
+ foaf:knows <https://example.edu/p/Alois#MSc>;
+ foaf:img <http://bob.example/picture.jpg>;
+ cert:key [ a cert:RSAPublicKey;
+ rdfs:label "made on 23 November 2011 on my laptop";
+ cert:modulus "cb24ed85d64d794b69c701c186acc059501e856000f661c93204d8380e07191c5c8b368d2ac32a428acb970398664368dc2a867320220f755e99ca2eecdae62e8d15fb58e1b76ae59cb7ace8838394d59e7250b449176e51a494951a1c366c6217d8768d682dde78dd4d55e613f8839cf275d4c8403743e7862601f3c49a6366e12bb8f498262c3c77de19bce40b32f89ae62c3780f5b6275be337e2b3153ae2ba72a9975ae71ab724649497066b660fcf774b7543d980952d2e8586200eda4158b014e75465d91ecf93efc7ac170c11fc7246fc6ded79c37780000ac4e079f671fd4f207ad770809e0e2d7b0ef5493befe73544d8e1be3dddb52455c61391a1"^^xsd:hexBinary;
+ cert:exponent 65537 ;
+ ] .
+</pre>
+</section>
+<section>
+<h1>RDFa HTML notation</h1>
+<p>RDFa in HTML [[!RDFA-CORE]] is a way to markup HTML with relations that have a well defined semantics and
+ mapping to an RDF graph. There are many ways of writing out the above graph using RDFa in
+HTML. Here is just one example of what a WebID profile could look like.
+</p>
+<pre class="example" style="word-wrap: break-word; white-space: pre-wrap;">
+<!DOCTYPE html>
+<html lang="en" prefix="cert: http://www.w3.org/ns/auth/cert# foaf: http://xmlns.com/foaf/0.1/ rdfs: http://www.w3.org/1999/02/22-rdf-syntax-ns# xsd: http://www.w3.org/2001/XMLSchema#">
+<head>
+ <title>Welcome to Bob's Home Page</title>
+</head>
+<body>
+<!-- WebID HTML snippet. The prefix attribute above can be moved into the div below if needed -->
+<div about="#me" typeof="foaf:Person">
+ <p>My name is <span property="foaf:name">Bob</span> and this is my picture: <img property="img" src="http://bob.example/picture.jpg" title="Bob" alt="Bob" /></p>
+ <h2>My Good Friends</h2>
+ <ul>
+ <li property="foaf:knows" href="https://example.edu/p/Alois#MSc">Alois</li>
+ </ul>
+ <h2>My RSA Public Keys</h2>
+ <div>
+ <p>I made this key on the 23 November 2011 from my laptop.</p>
+ <div property="cert:key" typeof="cert:RSAPublicKey">
+ <dl>
+ <dt>Comment</dt>
+ <dd property="rdfs:label">made on 23 November 2011 on my laptop</dd>
+ <dt>Modulus (hexadecimal)</dt>
+ <dd style="word-wrap: break-word; white-space: pre-wrap;"
+ property="cert:modulus" datatype="xsd:hexBinary">cb24ed85d64d794b69c701c186acc059501e856000f661c93204d8380e07191c5c8b368d2ac32a428acb970398664368dc2a867320220f755e99ca2eecdae62e8d15fb58e1b76ae59cb7ace8838394d59e7250b449176e51a494951a1c366c6217d8768d682dde78dd4d55e613f8839cf275d4c8403743e7862601f3c49a6366e12bb8f498262c3c77de19bce40b32f89ae62c3780f5b6275be337e2b3153ae2ba72a9975ae71ab724649497066b660fcf774b7543d980952d2e8586200eda4158b014e75465d91ecf93efc7ac170c11fc7246fc6ded79c37780000ac4e079f671fd4f207ad770809e0e2d7b0ef5493befe73544d8e1be3dddb52455c61391a1</dd>
+ <dt>Exponent (decimal)</dt>
+ <dd property="cert:exponent" datatype="xsd:integer">65537</dd>
+ </dl>
+ </div>
+ </div>
+
+</div>
+<!-- WebID HTML snippet -->
+</body>
+</html>
+</pre>
+<p>If a WebID provider would rather prefer not to mark up his data in RDFa, but
+just provide a human readable format for users and have the RDF graph appear
+in a machine readable format such as RDF/XML then a link from
+the HTML to a machine readable format MAY be published
+as follows:</p>
+ <p class="example">
+<pre>
+<html>
+<head>
+<link rel="alternate" type="application/rdf+xml" href="profile.rdf"/>
+</head>
+<body> ... </body>
+</html>
+</pre>
+</p>
+</section>
+<section>
+<h1>In Portable Contacts format using GRDDL</h1>
+<p class="issue">TODO: discuss other formats and GRDDL, XSPARQL options for xml formats</p>
+</section>
+</section>
+<section class='normative'>
+<h1>Disabling a WebID Certificate</h1>
+<p>A <tref>WebID Certificate</tref> identifies the <tref>Subject</tref> alone and no one else, if and only if that <tref>Subject</tref> is the only one to control the corresponding private key.
+It is very important therefore that the <tref>Subject</tref> take care of keeping the <tref>private key</tref> secure.
+This can be done by keeping it in the <tref>Key Store</tref> of a personal machine in an account that is password protected and free of viruses, or best of all on some physical device where the private key is inaccessible to be read by any software.
+In the second case having the device implies that the <tref>private key</tref> has not been lost or copied.
+In the first case the user has to be more careful for signals of misuse.<p>
+<p>In either situation if the <tref>Subject</tref> is suspicious that his private key has been taken, future authentications for that certificate can be disabled by removing the corresponding <tref>public key</tref> from the WebID Profile.
+ If the profile contains more than one public key for the <tref>Subject</tref> then it is suggested that each public key contain a label to help the user locate the key. In the examples above an <code>rdfs:label</code> with a creation date was used for this purpose.
+</p>
+</section>
+</section>
+
+<section class='normative'>
+<h1>The WebID Authentication Protocol</h1>
+
+<section class='normative'>
+<h1>Authentication Sequence</h1>
+
+<p>In order to give the full context of a <tref>Client</tref> interaction with a <tref>Server</tref> we will illustrate the protocol with the following sequence diagram.
+ <tref>Bob</tref> initiates a connection to <tref>Alice</tref>'s server via a TLS enabled protocol such as HTTPS in order to access a Protected Resource or a Protected Service.
+ The Protected Resource MUST be served over a <tref>TLS-Light Service</tref>, that will not do full <tref>CA</tref> authentication of <tref>Client</tref> <tref>Certificate</tref>s it receives.
+The Protected Resource MUST be a document served over HTTP or HTTPS.
+This resource is protected by a Guard, which uses a <tref>WebID Verifier</tref> to verify the non Certified WebIDs found in the certificate.
+ Once the verification succeeds the Guard checks to see if the Agent identified by the WebID is allowed access to the resource, by using trusted information from the Web and access control rules.
+</p>
+
+<img width="90%" src="img/WebIDSequence-friendly.jpg">
+<p>The steps in detail are as follows:</p>
+<ol>
+ <li><tref>Bob</tref>'s <tref>Client</tref> MUST open a TLS [[!RFC5246]] connection with the server which authenticates itself using well known TLS mechanisms.
+ This MAY be done as the first part of an HTTPS connection [[!HTTP-TLS]].
+ </li>
+ <li>Once the Transport Layer Security [TLS] has been set up, the application protocol exchange can start.
+ If the protocol is HTTP then the client can request an HTTP GET, PUT, POST, DELETE, ... action on a resource as detailed by [[!HTTP11]].
+ The <tref>Guard</tref> can then intercept that request and by checking some access control rules determine if the client needs authorization and hence authentication.
+ We will consider the case here where the client does need to be authenticated.
+ </li>
+ <li>The Guard MUST request the client to authenticate itself using public key cryptography by signing a token with its private key and have the Client send its Certificate. This has been carefully defined in the TLS protocol and can be summarized by the following steps:
+ <ol>
+ <li>The guard requests the TLS agent to make a Certificate Request to the client. The TLS layer does this. Because the WebID protocol does not rely on Certificate Authorities to verify the contents of the <tref>Certificate</tref>, the <tref>TLS Agent</tref> can ask for any Certificate from the Client. More details in <a href="#requesting-the-client-certificate">Requesting the Client Certificate</a>
+ </li>
+ <li>The Client asks Bob to choose a certificate if the choice has not been automated.
+ We will assume that Bob does choose a <tref>WebID Certificate</tref> and sends it to the client.
+ </li>
+ <li>The <tref>TLS Agent</tref> MUST verify that the client is indeed in possession of the private key.
+ What is important here is that the <tref>TLS Agent</tref> need not know the Issuer of the Certificate, or need not have any trust relation with the Issuer.
+ Indeed if the TLS Layer could verify the signature of the Issuer and trusted the statements it signed, then step 4 and 5 would not be needed - other than perhaps as a way to verify that the key was still valid.
+ </li>
+ <li>The <tref>WebID Certificate</tref> is then passed on to the <tref>Guard</tref> with the provision that the WebID still needs to be verified.
+ </li>
+ </ol>
+ </li>
+ <li>The <tref>Guard</tref> then MUST ask the <tref>Verification Agent</tref> to verify that the WebIDs in the WebID Certificate do identify the agent who knows the given <tref>Public Key</tref>.
+ </li>
+ <li>The <tref>Verification Agent</tref> MUST extract the <tref>Public Key</tref> and all the URI entries contained in the <code>Subject Alternative Name</code> extension of the <tref>WebID Certificate</tref>.
+ A <tref>WebID Certificate</tref> MAY contain multiple URI entries which are considered <tref>Claimed WebID</tref>s at this point, since they have not been verified.
+ The <tref>Verification Agent</tref> may verify as many or as few WebIDs it has time for.
+ It may do it in parallel and asynchronously.
+ However that is done, a <tref>Claimed WebID</tref> can only be considered verified if the following steps have been accomplished successfully:
+ </li>
+ <ol>
+ <li>The WebID Verifier must get access to an up to date version of the WebID Profile Graph.
+ <ol>
+ <li>If the WebID Verifier has an up to date version of the graph in its graph cache then it can return it.</li>
+ <li>Otherwise the <tref>WebID verifier</tref> MUST fetch an up to date version of the WebID Profile representation
+ by dereferencing the URI, using the canonical method for dereferencing a URL of that scheme.
+ For an <code>https://...</code> WebID this would be done using the [[!HTTP-TLS]] protocol.
+ The dereferencing of the URI MAY use any representation caching mechanism it can to speed up the process.
+ The returned representation is then transformed into an RDF graph [[!RDF-MT]] as specified in processing the WebID Profile .
+ This graph may be then be cached to speed up future requests.
+ </li>
+ </ol>
+ </li>
+ <li>The graph returned in the previous step is then queried as explained in <a href="#verifying-the-webids">Verifying the WebIDs</a>.
+ If the query is answered positively, then that WebID is verified.
+ If the query fails and the graph was not up to date, then the Verifier MAY start again at point 5.1.2 by making
+ a request to an up to date graph.
+ </li>
+ </ol>
+ <li>With the set of verified WebIDs the Guard can then check its access control rules using information from the web and other information available to it, to verify if the referent of the WebID is indeed allowed access to the protected resource.
+ The exact nature of those Access Control Rules is left for another specification.
+ Suffice it to say that it can be something as simple as a lookup in a table.
+ </li>
+ <li>If access is granted, then the guard can pass on the request to the protected resource, which can then interact unimpeded with the client.
+ </li>
+</ol>
+</section>
+
+<section class='normative'>
+<h1>Authentication Sequence Details</h1>
+
+<p>This section covers details about each step in the authentication process.
+</p>
+
+<section class='normative'>
+<h2>Initiating a TLS Connection</h2>
+
+<p>Standard SSLv3 and TLSv1 and upwards can be used to establish the connection between
+the Client and the <tref>TLS Agent</tref> listening on the Service's port. </p>
+<p class="note">Many servers allow a simple form of TLS client side authentication to be setup when configuring a <tref>TLS Agent</tref>: they require the agent to be authenticated in WANT or NEED mode before any further interaction can take place.
+If the client sends a certificate, then neither of these have an impact on the <tref>WebID Verification</tref> steps (4) and (5).
+Nevertheless, from a user interaction perspective both of these are problematic as they either force (NEED) or ask the user to authenticate himself even if the resource he wishes to interact with is public and requires no authentication.
+Furthermore very few people will feel comfortable authenticating to a web site on the basis of reading the server certificate alone.
+Most people would like to know more about what the web site claims to be about before divulging their identity.
+This is usually done by reading a few web pages without being authenticated.
+Hence it is important for human users that authentication be only requested on user demand.
+
+This can be done by using TLS renegotiation and moving the authentication to the application layer <tref>Guard</tref> which can make more fine grained decisions on when authentication is required.
+Please see the <a href="http://www.w3.org/2005/Incubator/webid/wiki/">WebID Wiki</a> for implementation pointers in different programming languages and platforms to learn about how this can be done and to share your experience.</p>
+</section>
+
+<section class='normative'>
+<h2>Connecting at the Application Layer</h2>
+
+<p>Once the TLS connection has been setup, the application layer protocol interaction can start.
+This could be an HTTP GET request on the protected resource for example.
+<p>If the protocol permits it, the Client can let the Application layer, and especially the <tref>Guard</tref> know that the client can authenticate with a WebID Certificate, and even if it wishes to do so. This may be useful both to allow the Server to know that it can request the client certificate, and also in order to make life easier for Robots that may find it a lot more convenient to be authenticated at the TLS layer.
+</p>
+<p class="issue">Bergi proposed a header for HTTP which could do this. Please summarise it. </p>
+</section>
+
+
+<section class='normative'>
+<h2>Requesting the Client Certificate</h2>
+
+<p>TLS allows the server to request a Certificate from the Client using the <code>CertificateRequest</code> message [Section 7.4.4] of TLS v1.1 [[!RFC5246]]. Since WebID TLS authentication does not rely on CAs signing the certificate to verify the WebID Claims made therein, the Server does not need to restrict the certificate it receives by the CAs they were signed by. It can therefore leave the <code>certificate_authorities</code> field blank in the request. </p>
+<p class="note">From our experience leaving the certificate_authorities field empty leads to the correct behavior on all browsers and all TLS versions.</p>
+<p class="note">A security issue with TLS renegotiation was discovered in 2009, and an IETF fix was proposed in [[!RFC5746]] which is widely implemented.</p>
+<p>If the Client does not send a certificate, because either it does not have one or it does not wish to send one, other authentication procedures can be pursued at the application layer with protocols such as OpenID, OAuth, BrowserID, etc... </p>
+<p>As much as possible it is important for the server to request the client certificate in <code>WANT</code> mode, not in <code>NEED</code> mode.
+If the request is made in <code>NEED</code> mode then connections will be broken off if the client does not send a certificate.
+This will break the connection at the application protocol layer, and so will lead to a very bad user experience. The server should therefore avoid doing this unless it can be confident that the client has a certificate - which it may be because the client advertised that in some other way to the server.
+</p>
+<p class="issue">Is there some normative spec about what NEED and WANT refer to?</p>
+
+</section>
+<section class='normative'>
+<h2>Verifying the WebIDs</h2>
+<p>The <tref>Verification Agent</tref> is given a list of WebIDs associated with a public key. It needs to verify that the agent identified by that WebID is indeed the agent that controls the private key of the given public key. It does this by looking up the definition of the WebID. A WebID is a URI, and its meaning can be obtained by dereferencing it using the protocol indicated in its scheme. </p>
+<p>If we first consider WebIDs with fragment identifiers, we can explain the logic of this as follows. As is explained in the RFC defining URIs [[!RFC3986]]:
+<blockquote>
+The fragment identifier component of a URI allows indirect identification of a secondary resource by reference to a primary resource and additional identifying information.
+The identified secondary resource may be some portion or subset of the primary resource, some view on representations of the primary resource, or some other resource defined or described by those representations.
+[...]
+The semantics of a fragment identifier are defined by the set of representations that might result from a retrieval action on the primary resource.
+</blockquote>
+<p>In order therefore to know the meaning of a WebID containing a fragment identifier, one needs to dereference the resource referred to without the fragment identifier.
+This resource will describe the referent of the WebID using a syntax convertible to RDF triples.
+If the document returned states that the referent of the WebID is the agent that controls the private key of the given public key, then this is a definite description that can be considered to be a definition of the WebID: it gives its meaning.
+</p>
+<p>The trust that can be had in that statement is therefore the trust that one can have in one's having received the correct representation of the document that defined that WebID.
+An HTTPS WebID will therefore be a lot more trustworthy than an HTTP WebID by a factor of the likelihood of man in the middle attacks.</p>
+<p>Once that is proven then the trust one can have in the agent at the end of the TLS connection being the referent of the WebID is related to the trust one has in the cryptography, and the likelihood that the private key could have been stolen.</p>
+<p class="issue">Add explanation for URI with redirect.</p>
+<section class='normative'>
+<h2>Processing the WebID Profile</h2>
+
+<p>The Verification Agent needs to fetch the document, if it does not have a valid one in cache.
+The WebID <tref>Verification Agent</tref> MUST be able to parse documents in TURTLE [[!TURTLE-TR]], and MAY be able to also parse them in RDFa [[!RDFA-CORE]] and RDF/XML [[!RDF-SYNTAX-GRAMMAR]].
+The result of this processing should be a graph of RDF relations that is queryable, as explained in the next section.</p>
+<p class="note">
+The <tref>Verification Agent</tref> MUST set the Accept-Header to request <code>text/turtle</code> with a higher priority than <code>text/html</code> and <code>application/rdf+xml</code>. The reason is that it is quite likely that many sites will produce non marked up HTML and leave the graph to the pure RDF formats.
+</p>
+<p>If the <tref>Guard</tref> wishes to have the most up-to-date Profile document for an HTTPS URL, it can use the HTTP cache control headers to get the latest versions.</p>
+</section>
+
+<section class='normative'>
+<h2>Verifying the WebID Claim</h2>
+
+<p>
+To check a WebID claim one has to find if the graph returned by the profile relates the WebID to the <tref>Certificate</tref> <tref>Public Key</tref> with the <code>cert:key</code> relation. In other words one has to check if those statements are present in the graph.</p>
+
+<section class="normative">
+<h2>Verifying the WebID Claim with SPARQL</h2>
+<p>Testing for patterns in graphs is what the SPARQL query language is designed to do [[!RDF-SPARQL-QUERY]]. We will first look at how to use this as it is also the simplest method, and then what some other programmatic options may be.</p>
+<p>Below is the SPARQL Query Template which should be used for an RSA public key. It contains three variables <code>?webid</code>, <code>?mod</code> and <code>?exp</code> that need to be replaced by the appropriate values:</p>
+<pre style="word-wrap: break-word; white-space: pre-wrap;">
+PREFIX : <http://www.w3.org/ns/auth/cert#>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+ASK {
+ ?webid :key [
+ :modulus ?mod;
+ :exponent ?exp;
+ ] .
+}
+</pre>
+<p>The variables to be replaced for each WebID claim are:</p>
+<table style="text-align: left; border-color: rgb(0, 0, 0); border-collapse: collapse; wordwrap: break-word; white-psace: pre-wrap" border="1" cellpadding="5">
+<thead>
+ <tr>
+ <th>Variable</th>
+ <th>Details on its value.</th>
+ </tr>
+</thead>
+<tbody>
+<tr><td><code>?webid</code></td><td>should be replaced by the WebID Resource. In the SPARQL notation that is the URL string would be placed between <code><...></code> in the position of the <code>?webid</code> variable. </td></tr>
+<tr><td><code>?mod</code></td><td>should be replaced by the modulus written as a xsd:hexBinary as specified by the <a href="http://www.w3.org/ns/auth/cert#modulus">cert:modulus</a> relation. All leading double 0 bytes (written "00" in hexadecimal) should be removed. The resulting hexadecimal should then be placed in the space of the XXX in <code>"XXX"^^xsd:hexBinary</code> </td></tr>
+<tr><td><code>?exp</code></td><td>should be replaced by the public exponent written as an xsd:integer typed literal. In SPARQL as in Turtle notation this can just be written directly as an integer.</td></tr>
+</tbody>
+</table>
+
+<p>Assuming that we received Bob's key whose modulus starts with <code>cb24ed85d64d794b6...</code> and whose exponent is <code>65537</code> then the following query should be used:
+</p>
+<pre class='example' style="word-wrap: break-word; white-space: pre-wrap;">
+PREFIX : <http://www.w3.org/ns/auth/cert#>
+PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
+ASK {
+ <https://bob.example/profile#me> :key [
+ :modulus "cb24ed85d64d794b69c701c186acc059501e856000f661c93204d8380e07191c5c8b368d2ac32a428acb970398664368dc2a867320220f755e99ca2eecdae62e8d15fb58e1b76ae59cb7ace8838394d59e7250b449176e51a494951a1c366c6217d8768d682dde78dd4d55e613f8839cf275d4c8403743e7862601f3c49a6366e12bb8f498262c3c77de19bce40b32f89ae62c3780f5b6275be337e2b3153ae2ba72a9975ae71ab724649497066b660fcf774b7543d980952d2e8586200eda4158b014e75465d91ecf93efc7ac170c11fc7246fc6ded79c37780000ac4e079f671fd4f207ad770809e0e2d7b0ef5493befe73544d8e1be3dddb52455c61391a1"^^xsd:hexBinary;
+ :exponent 65537;
+ ] .
+}
+</pre>
+<p>An ASK query simply returns true or false. If it returns true, then the key was found in the graph with the proper relation and the claim is verified.</p>
+<p>In order to allow the class of queries defined by the template above to return true when asked of graphs where the hexBinary or the exponent contains whitespace characters in initial and final position, the query engine MUST support the D-entailment regime for <code>xsd:hexBinary</code> and <code>xsd:integer</code> as specified in <a href="http://www.w3.org/TR/sparql11-entailment/#DEntRegime">SPARQL 1.1 Entailment Regimes</a>.</p>
+<p>For verifiers that do not have access to a SPARQL query engine but can query the RDF data programmatically, it is relatively easy to emulate the above SPARQL query programmatically. There are a number of ways of doing this, some more efficient than others.<p>
+</section>
+<section class="normative">
+<h2>Verifying the WebID claim without SPARQL</h2>
+<p>If the RDF library does datatype normalization of all literals before loading them, then the most efficient way to execute this would be to start by searching for all triples whose subjects have relation <code>cert:modulus</code> to the literal which in our example was <code>"cb24ed..."^^xsd:hexBinary</code>. One would then iterate through all the subjects of the relations that satisfied that condition, which would most likely never number more than one, and from there filter out all those that were the object of the <code>cert:modulus</code> relation of the WebID - in the example <code>bob:me</code>. Finally one would verify that one of the keys that had satisfied those relations also had the <code>cert:exponent</code> relation to the number which in the example above is <code>"65537"^^xsd:integer</code>.
+</p>
+<p>For triples stores that do not normalize literals on loading a graph, the normalization will need to be done after the query results and before matching those with the values from the <tref>Certificate</tref>. Because one could not rely on the modulus having been normalized, one would have to start with the WebID - <code>bob:me</code> and find all it's <code>cert:key</code> relations to objects - which we know to be keys - and then iterate through each of those keys' modulus and exponent, and verify if the normalized version of the value of those relation is equal to the numbers found in the certificate. If one such key is found then the answer is <code>true</code>, otherwise the answer will be <code>false</code>.</p>
+</section>
+</section>
+<section class='normative'>
+<h2>Authorization</h2>
+
+<p>The Authorization step may be as simple as just allowing everybody read access. The authentication phase may then just have been useful in order to gain some extra information from the WebID Profile in order to personalize a site -- e.g. displaying a user's picture.</p>
+<p>Once the <tref>Guard</tref> has a WebID he can do a lookup in a database to see if the agent is allowed the required access to the given resource.
+Up to this point we are not much more advanced that with a user name and password, except that the user did not have to create an account on Alice's server to identify himself and that the server has some claimed attributes to personalize the site for the requestor.
+But the interesting thing about such a WebID is that because it is a global linkable URI, one can build webs of trust that can be crawled the same way the web can be crawled: by following links from one document to another.
+It is therefore possible to have very flexible access control rules where parts of the space of the user's machine is given access to friends and those friends' friends (FOAF), stated by them at their domains.
+It is even possible to allow remote agents to define their own access control rules for parts of the machine's namespace.
+There are too many possibilities to list them all here.
+</p>
+
+
+</section>
+
+</section>
+</section>
+</section>
+
+<section class="informative">
+ <h2>Security Model</h2>
+ <p class="issue">this is a section that can look at different security issues such as
+ possible attack scenarios.
+ </p>
+</section>
+
+<section class='appendix informative' id="history">
+<h1>Change History</h1>
+<p><a href="https://dvcs.w3.org/hg/WebID/rev/46e0aadef7b6">2011-12-12</a>
+Fixed several errors in examples and diagrams, clarified TLS-Light, added SSL renegotiation, key chain and cache control, updated list people in acknowledgments.
+</p>
+<p><a href="http://www.w3.org/2005/Incubator/webid/spec/drafts/ED-webid-20111123/">2011-11-23</a>
+Wide ranging changes: Rewrote the Verification algorithm now enhanced with a detailed sequence diagram. Moved to new ontology using xsd:hexBinary datatypes and removed rsa: ontology. Rewrote vocabulary section using clearer names. All these changes required serious rewriting everywhere.
+</p>
+<p><a href="https://dvcs.w3.org/hg/WebID/rev/6b60d7335151">2011-02-10</a>
+Move to <a href="http://www.w3.org/2005/Incubator/webid/">W3C WebID XG</a>.
+Updates from previous unofficial WebID group include changes on
+RDF/XML publishing in HTML, clarification on multiple SAN URIs and
+WebID verification steps.
+</p>
+<p><a href="https://dvcs.w3.org/hg/WebID/rev/dc93b6bbc538">2010-08-09</a>
+Updates from WebID community: moved OpenID/OAuth sections to separate document,
+switched to the URI terminology instead of URL, added "Creating the certificate"
+and "Publishing the WebID Profile document" sections with a WebID graph and
+serializations in Turtle and RDFa, improved SPARQL queries using literal
+notation with cert datatypes, updated list of contributors,
+and many other fixes.</p>
+<p><a href="https://dvcs.w3.org/hg/WebID/rev/4aef27947dec">2010-07-25</a>
+Added WebID Profile section.</p>
+<p><a href="https://dvcs.w3.org/hg/WebID/rev/805d44635286">2010-07-18</a>
+Updates from WebID community related to RDF/XML support, authentication sequence
+corrections, abstract and introduction updates.</p>
+<p><a href="https://dvcs.w3.org/hg/WebID/rev/25ba7f596f07">2010-07-11</a>
+Initial version.</p>
+</section>
+
+<section class='informative' id="acknowledgements">
+<h1>Acknowledgments</h1>
+
+<p>The following people have been instrumental in providing thoughts, feedback,
+reviews, criticism and input in the creation of this specification:
+Thomas Bergwinkl, Tim Berners-Lee, Sarven Capadisli, Melvin Carvalho, Martin Gaedke, Michael Hausenblas, Kingsley Idehen, Ian Jacobi, Nathan Rixham, Seth Russell, Andrei Sambra, Jeff Sayre, Dominik Tomaszuk, Mo McRoberts, David Chadwick, Patrick Logan, Peter Williams, Mischa Tuffield, Pierre Antoine Champin, Reto Bachman Gmür, Antoine Zimmermann.
+
+</section>
+ </body>
+</html>
+