D-entailment MUST added and as a result also added section for programmatic version of the same - since it is likely that still very few tools have the full SPARQL support. bblfish
authorHenry Story <henry.story@bblfish.net>
Thu, 08 Dec 2011 13:09:38 +0100
branchbblfish
changeset 232a5b20104919b
parent 231 d8569b84b72b
child 233 99b7be0aa7f6
child 239 add4f836470d
D-entailment MUST added and as a result also added section for programmatic version of the same - since it is likely that still very few tools have the full SPARQL support.
spec/index-respec.html
     1.1 --- a/spec/index-respec.html	Tue Dec 06 22:40:58 2011 +0100
     1.2 +++ b/spec/index-respec.html	Thu Dec 08 13:09:38 2011 +0100
     1.3 @@ -373,7 +373,7 @@
     1.4  <dt><tdef>Subject</tdef></dt>
     1.5  <dd>The Subject is the Agent that is identified by the <tref>WebID</tref>.
     1.6  When used legally it is the Subject who wishes to authenticate to a <tref>Service</tref>.
     1.7 -We will name our princiap Subject <tref>Bob</tref> throughout the text, when this helps lisibility.
     1.8 +We will name him  <tref>Bob</tref> throughout the text when this helps lisibility.
     1.9  The Subject is distinct from the <tref>Client</tref> which is used to connect to the <tref>Server</tref>.
    1.10  </dd>
    1.11  <dt><tdef>Client</tdef></dt>
    1.12 @@ -879,7 +879,8 @@
    1.13  <p>
    1.14  To check a WebID claim one has to find if the graph returned by the profile  relates the <tref>WebID</tref> 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>
    1.15  
    1.16 -
    1.17 +<section class="normative">
    1.18 +<h2>Verifying the WebID Claim with SPARQL</h2>
    1.19  <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>
    1.20  <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>
    1.21  <pre style="word-wrap: break-word; white-space: pre-wrap;">
    1.22 @@ -902,7 +903,7 @@
    1.23  </thead>
    1.24  <tbody>
    1.25  <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>&lt;...&gt;</code> in the position of the <code>?webid</code> variable. </td></tr>
    1.26 -<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 hexadecmial should then be placed in the space of the XXX in <code>"XXX"^^xsd:hexBinary</code> </td></tr>
    1.27 +<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>
    1.28  <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>
    1.29  </tbody>
    1.30  </table>
    1.31 @@ -919,10 +920,15 @@
    1.32     ] .
    1.33  }
    1.34  </pre>
    1.35 -<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 has been verified.</p>
    1.36 -<p class="issue"> The public key could be a DSA key. We need to add an ontology
    1.37 -for DSA too.</p>
    1.38 -
    1.39 +<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>
    1.40 +<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>
    1.41 +<p>For verifiers that do not have access to a SPARQL query engine but that do have access programmatically to a triple store, 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>
    1.42 +</section>
    1.43 +<section class="normative">
    1.44 +<h2>Verifying the WebID claim without SPARQL</h2>
    1.45 +<p>If the triple store does dataype normalisation 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 <tref>WebID</tref> - 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>.  
    1.46 +</p>
    1.47 +<p>For triples stores that do not normalise literals on loading a graph, the normalizatino 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 <tref>WebID</tref> - <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 normalised 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>
    1.48  </section>
    1.49  </section>
    1.50  <section class='normative'>