3 require_once('library/asn1.php');
5 function modexp_init(App &$a) {
11 $r = q("SELECT `spubkey` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
15 if (! dbm::is_result($r)) {
19 $lines = explode("\n",$r[0]['spubkey']);
21 unset($lines[count($lines)]);
22 $x = base64_decode(implode('',$lines));
24 $r = ASN_BASE::parseASNString($x);
26 $m = $r[0]->asnData[1]->asnData[0]->asnData[0]->asnData;
27 $e = $r[0]->asnData[1]->asnData[0]->asnData[1]->asnData;
29 header("Content-type: application/magic-public-key");
30 echo 'RSA' . '.' . $m . '.' . $e ;