summaryrefslogtreecommitdiff
path: root/keys.php
blob: b5e6f8fb5b6a7ed169f8444c58621937bf823ee2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php

require_once "init.php";

if (array_key_exists('k', $_GET)
&& (preg_match('/^[0-9A-Fa-f]{40}$/', $_GET['k']) !== false))
  $output = shell_exec('gpg -a --export ' . $_GET['k']);
  print $output;
  if (empty($output)) {
    $fh = fopen('key-wishlist', 'a');
    if ($fh !== false) {
      fwrite($fh, $_GET['k'] . "\n");
      fclose($fh);
    }
  }
else
  print shell_exec('gpg --list-keys --with-colons');