4 use Friendica\Database\DBM;
6 function modexp_init(App $a) {
12 $r = q("SELECT `spubkey` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
16 if (! DBM::is_result($r)) {
20 $lines = explode("\n",$r[0]['spubkey']);
22 unset($lines[count($lines)]);
23 $x = base64_decode(implode('',$lines));
25 $r = ASN_BASE::parseASNString($x);
27 $m = $r[0]->asnData[1]->asnData[0]->asnData[0]->asnData;
28 $e = $r[0]->asnData[1]->asnData[0]->asnData[1]->asnData;
30 header("Content-type: application/magic-public-key");
31 echo 'RSA' . '.' . $m . '.' . $e ;