. * *************************************************************/ // before anything else, check that data has arrived here via HTTPS if ($_SERVER['HTTPS'] != "on") { die ("Use a secure HTTPS connection to the server. Aborting ..."); } if (! is_file("gpgconfig.php")){ die ("Config file does not exist."); } require_once('gpgconfig.php'); if (! is_dir($GPGDIR)){ die ("GPG directory $GPGDIR does not exist."); } else { $ERRORFILE = $GPGDIR."/gpgerrors"; } if (! isset($KEYEXPORT)) { $KEYEXPORT = "no"; } if (! isset($SECRETKEYEXPORT)) { $SECRETKEYEXPORT = "no"; } if (isset($_REQUEST['keyid'])) { $KEYID = checkinput($_REQUEST['keyid'], "noscript"); } if (isset($_REQUEST['keytype'])) { $KEYTYPE = checkinput($_REQUEST['keytype'], "noscript"); } echo "
\n"; if (isset($KEYID) && isset($KEYTYPE)) { if ($KEYEXPORT == "yes") { // Key export echo "

Key Export

\n"; $EXPORT = ""; if (($KEYTYPE == "secretkey") && ($SECRETKEYEXPORT == "yes")) { $EXPORT ="/usr/bin/gpg --homedir ".$GPGDIR." --armor --logger-file ".$ERRORFILE." --output - --export-secret-keys \"".$KEYID."\"" ; } if ($KEYTYPE == "publickey") { $EXPORT ="/usr/bin/gpg --homedir ".$GPGDIR." --armor --logger-file ".$ERRORFILE." --output - --export \"".$KEYID."\"" ; } if (! empty($EXPORT)) { $RESULT = unix2 ($EXPORT,$GPGDIR); // check if key export is successful $ERR1 = strpos($RESULT,'no signed data'); $ERR2 = strpos($RESULT,'the signature could not be verified'); if (($ERR1 === false) && ($ERR2 === false)){ echo "\n"; echo "\n

\n"; } else { echo "

Key export failed.

"; echo "\n"; } } else { echo "

Key export is not allowed.

"; echo "\n"; } } else { echo "

Key export is not allowed.

"; echo "\n"; } } else { echo "

Key export failed.

\n"; echo "\n"; } echo "

version ".$VERSION." powered by Senderek Web Security

"; echo "\n

\n"; ?>