Add better info to GPG classes

This commit is contained in:
the-djmaze 2022-11-17 11:29:46 +01:00
parent 38daad6d9b
commit 99816083ef
2 changed files with 17 additions and 1 deletions

View file

@ -10,7 +10,7 @@ class GnuPG
{ {
private private
$homedir, $homedir,
// Instance of gnupg pecl extension // Instance of gnupg pecl extension https://www.php.net/gnupg
$GnuPG, $GnuPG,
// Instance of \SnappyMail\PGP\GPG // Instance of \SnappyMail\PGP\GPG
$GPG; $GPG;

View file

@ -188,6 +188,20 @@ class GPG
return true; return true;
} }
/**
* TODO: parse result
* https://github.com/the-djmaze/snappymail/issues/89
*/
protected function listDecryptKeys(/*string|resource*/ $input, /*string|resource*/ $output = null)
{
$this->setInput($input);
$fclose = $this->setOutput($output);
$_ENV['PINENTRY_USER_DATA'] = '';
$result = $this->exec(['--list-packets']);
$fclose && \fclose($fclose);
return $output ? true : ($result ? $result['output'] : false);
}
protected function _decrypt(/*string|resource*/ $input, /*string|resource*/ $output = null) protected function _decrypt(/*string|resource*/ $input, /*string|resource*/ $output = null)
{ {
$this->setInput($input); $this->setInput($input);
@ -245,6 +259,7 @@ class GPG
*/ */
public function decryptVerify(string $text, string &$plaintext) /*: array|false*/ public function decryptVerify(string $text, string &$plaintext) /*: array|false*/
{ {
// TODO: https://github.com/the-djmaze/snappymail/issues/89
return false; return false;
} }
@ -253,6 +268,7 @@ class GPG
*/ */
public function decryptVerifyFile(string $filename, string &$plaintext) /*: array|false*/ public function decryptVerifyFile(string $filename, string &$plaintext) /*: array|false*/
{ {
// TODO: https://github.com/the-djmaze/snappymail/issues/89
return false; return false;
} }