GnuPG, PHP and password file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Folks:

I'm running PHP 8.x on Debian 11, with Apache2 as the server. I have a
password (text) file which is GnuPG encrypted: /home/paulf/wallet.gpg.
I'd like to have web access to the data in this file. I'm using the
following code:

===

$file = '/home/paulf/.wallet.gpg';
$token = gnupg_init(['file_name' => '/usr/bin/gpg', 'home_dir' =>
'/home/paulf']);
$encrypted = file_get_contents($file); $decrypted =
gnupg_decrypt($token, $encrypted);

$newlined = nl2br($decrypted);
$indented = str_replace("\t", '    ', $newlined);

header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");

?>
<html>
<head>
<style>
body {
        background-color: #222222;
        color: #ffffff;
        font-family: Sans-Serif;
}
</style>
<title>Wallet</title>
</head>
<body>
<?php echo $indented; ?>
</body>
</html>

===

At some point in the past, this code popped up a dialog box which asked
for my passphrase, and then opened and displayed the file. Now it
doesn't work, and I just get a blank screen. No error message shows in
Apache's log.

Anyone know why this isn't working, and what I can do about it? Or is
there a better solution?

Paul

-- 
Paul M. Foster
Personal Blog: http://noferblatz.com
Company Site: http://quillandmouse.com
Software Projects: https://gitlab.com/paulmfoster



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux