[foaf-protocols] FOAF+SSL: Inserting a Public Key into a Remote Profile Using SPARUL
Melvin Carvalho
melvincarvalho at gmail.com
Sun Jun 28 18:48:18 CEST 2009
Short PHP script to insert a FOAF+SSL public key remotely using SPARUL
and HTTP POST.
I've removed all bnodes in this, and have hardcoded four anchors,
which might not be the best style, but it works.
#cert
#modulus
#public_exponent
#me
Hope this is useful, let me know if you think of any way of improving this.
http://gist.github.com/137310
<?php
function postSparul($uri, $sparul)
{
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $uri);
curl_setopt($c, CURLOPT_POST, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $sparul);
curl_exec ($c);
curl_close ($c);
}
$webid = 'http://foaf.me/test';
$public_exponent = 65537;
$modulus = 'B5EBEFF72746A12FB96BE4FF73959C5163D342BF21A1046DBD3EE181FC6654D29903AE97764D8E8CBAF4B830A79073BECD0AAAD5FC9C9847551A9CEF548AE2CDFD4F0B6578CD31CEB711EEFF0CB7F9F922FA107CCDCE4832CCB51D7C319069168DEE3801F5490F6D21BD8211918F40749A99A4ECDF872AA59CA861AC36D010B1';
postSparul("$webid", "INSERT { <$webid#cert>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://www.w3.org/ns/auth/rsa#RSAPublicKey> ;
<http://www.w3.org/ns/auth/cert#identity> <$webid#me> ;
<http://www.w3.org/ns/auth/rsa#modulus> <$webid#modulus> ;
<http://www.w3.org/ns/auth/rsa#public_exponent>
<$webid#public_exponent> . <$webid#modulus>
<http://www.w3.org/ns/auth/cert#hex> \"$modulus\" .
<$webid#public_exponent> <http://www.w3.org/ns/auth/cert#decimal>
\"$public_exponent\" . }");
?>
More information about the foaf-protocols
mailing list