spec is good

*Im feeling a lot better about the spec, now Ive been through most of a first implementation letting what it says actually lead my thinking. My old dotNet stuff continued to work fine when reduced to now 50 lines working on IIS, and on using the morph translation service that guesses the format of document at the webid URI and gives me rdf/xml (which my statement analyzer can handle). Morph seemed perfectly happy to parse the RDFa graph at blogspot, despite it being surrounded by interactive HTML body elements. This is all making me feel very good. This is how it all should feel. Now, I have not made it all work, as I'm taking a little longer than I expected to get used to all this stuff again. It all looked quite alien, when I looked at it anew, last week for the first time in years. But, it will work, Im sure. its at 95% of where it once was, a but of script sitting on a webserver, with modern conformance and MUCH simpler CA stuff than the CA scripting I did originally. So let's add up: - standard CA tools mint certs. Any of a million Windows IT admins can do it. Different issuing styles for different cultures.  Web site cert enrollment for browser-centric folk.- perfectly normal https setup on IIS (since not worrying about null DN certificate authority list)- cut and paste to a blog post addresses key distribution; should be easy to automate cert/RDFa distribution using a bloggers Post port- stream based data translation services imposes common format (on processing graphs, post), streaming RDFa to RDF/XML- statement analyzer library reads common statement format  (the RDF/XML)- sparql ASK augmented by RDFS reasoner is doing its thing (once some gotchas go away).- Getting the client cert out of ASP.NET is trivial, as is getting the modulus as a byte array (then hex).- The rest is just setup the sparql ASK.- ill worry about redirects once the spec says something (not being an expert in querying, etc). Now, since there is nothing to this code, set, Ill post the current guts below. The ask give a false result, in the resultset XML. But, then its a literal match, I believe. Im not sure what to do, per the theory of the query. The hex I make from the cert happens to upper case, no space. Whereas the literal from the modulus statement happens (by inspection) to be lower case, with spaces. Under the clean structure, Im doing no canonliczation of the inbound statement, and not knowing which variant of the posible hex codings the value has, I cannot know how specially to format the cert hex.  I was just expecting match miracles (possiby unreasonably) {<sparql xmlns="http://www.w3.org/2001/sw/DataAccess/rf1/result">
  <head />
  <boolean>false</boolean>
</sparql>} protected void Page_Load(object sender, EventArgs e)
    {
        Uri webid               = new Uri("http://yorkporc.blogspot.com/2011/11/bob.html#me");
        Uri webidTalis          = new Uri("http://morph.talis.com/?data-uri%5B%5D=http%3A%2F%2Fyorkporc.blogspot.com%2F2011%2F11%2Fbob.html%23me&input=&output=rdf");

        if (Request.ClientCertificate == null)
             throw new HttpException("No client certificate present");

        MemoryStore store = new MemoryStore();

        try
        {
            RDFS engine = new RDFS();
            engine.LoadSchema(RdfReader.LoadFromUri(new Uri(FOAFont)));
            store.AddReasoner(engine);
        }
        catch (Exception)
        {                
            throw new HttpException("could not load RDFS schema");
        }

        try
        {
            store.Import(RdfReader.LoadFromUri(webidTalis));
        }
        catch (Exception)
        {                
            throw new HttpException("could not load webid document");
        }

        X509Certificate2 cert = new X509Certificate2(Request.ClientCertificate.Certificate);
        RSACryptoServiceProvider rsa = cert.PublicKey.Key as RSACryptoServiceProvider;
        RSAParameters rsaparm = rsa.ExportParameters(false);
 
        string CertModString = ToHex(rsaparm.Modulus);
        
        if (!((rsaparm.Exponent[0] == 0x01)
            && (rsaparm.Exponent[1] == 0x00)
            && (rsaparm.Exponent[2] == 0x01)))
            throw new HttpException("Cert Exponent not 0x10001");

        // send the query/result back to the client for eval
        StringBuilder sb = new StringBuilder(1000);
        StringWriter xmltw = new StringWriter(sb);

        string s = String.Format(webid2key2, "{", webid.ToString(), CertModString, "65537", "}");
        SparqlEngine sparq = new SparqlEngine(s);
        sparq.Ask(store, xmltw);

        xmltw.Flush();

        Response.Write(sb.ToString());

        FormsAuthentication.RedirectFromLoginPage( "user", false );
    }
}   		 	   		  

Received on Sunday, 27 November 2011 07:01:25 UTC