More '<?$' => '<?php$'
[Trubanc.git] / makekey.php
blob45e244550a2bcf02bab94398be7645f9deb8844d
1 <?php
2 require_once "lib/ssl.php";
4 function mq($x) {
5 if (get_magic_quotes_gpc()) return stripslashes($x);
6 else return $x;
9 $keysize = mq($_REQUEST['keysize']);
10 $passphrase = mq($_REQUEST['passphrase']);
13 <html>
14 <head>
15 <title>Public Key Forge</title>
16 </head>
17 <body>
18 <?php
19 if ($keysize && is_numeric($keysize)) {
21 $ssl = new ssl();
22 $privkey = $ssl->make_privkey($keysize, $passphrase);
23 $pubkey = $ssl->privkey_to_pubkey($privkey, $passphrase);
24 $id = $ssl->pubkey_id($pubkey);
26 echo "ID: $id<br>\n";
27 echo "<pre>\n$pubkey</pre>\n";
28 echo "<pre>\n$privkey</pre>\n";
31 if (!$keysize || !is_numeric($keysize)) $keysize = 512;
33 function hsc($x) {
34 return htmlspecialchars($x);
38 <form method="post">
39 <table>
40 <tr>
41 <td>Key size:</td>
42 <td><input type="text" name="keysize" value="<?php echo hsc($keysize); ?>"/></td>
43 </tr><tr>
44 <td>Passphrase:</td>
45 <td><input type="password" name="passphrase" value=""/></td>
46 </tr><tr>
47 <td>&nbsp;</td>
48 <td><input type="submit" value="Generate"/></td>
49 </tr>
50 </table>
51 </form>
52 </body>
53 </html>