]> git.mxchange.org Git - friendica.git/blob - mod/modexp.php
Small tweak to a copule of translatable strings
[friendica.git] / mod / modexp.php
1 <?php
2
3 require_once('library/asn1.php');
4
5 function modexp_init(&$a) {
6
7         if($a->argc != 2)
8                 killme();
9
10         $nick = $a->argv[1];
11         $r = q("SELECT `spubkey` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
12                         dbesc($nick)
13         );
14
15         if(! count($r))
16                 killme();
17
18         $lines = explode("\n",$r[0]['spubkey']);
19         unset($lines[0]);
20         unset($lines[count($lines)]);
21         $x = base64_decode(implode('',$lines));
22
23         $r = ASN_BASE::parseASNString($x);
24
25         $m = $r[0]->asnData[1]->asnData[0]->asnData[0]->asnData;
26         $e = $r[0]->asnData[1]->asnData[0]->asnData[1]->asnData;
27
28         header("Content-type: application/magic-public-key");
29         echo 'RSA' . '.' . $m . '.' . $e ;
30
31         killme();
32
33 }
34