$gpg = new gnupg(); $gpg->addencryptkey("8660281B6051D071D94B5B230549F9DC851566DC");
var_dump(
$gpg->geterror(),
$gpg->encrypt("just a test")
);
OUTPUT:
string(14) "get_key failed"
bool(false)
Why?
On 2022-05-28, Fx ROOM <naso@tata.new> wrote:
$gpg = new gnupg();
$gpg->addencryptkey("8660281B6051D071D94B5B230549F9DC851566DC");
var_dump(
$gpg->geterror(),
$gpg->encrypt("just a test")
);
OUTPUT:
string(14) "get_key failed"
bool(false)
Why?
The addencryptkey() makes a call to gnupg (do you have that installed,
is GNUPGHOME environment variable set, is the key known to gnupg? etc.)
https://www.php.net/manual/en/function.gnupg-addencryptkey.php
In any case
$ echo $GNUPGHOME
/tmp/key4656
$ mkdir /tmp/key4656
$ cat encrypt
#!/usr/bin/php
<?php
$gpg = new gnupg(); $gpg->addencryptkey("8660281B6051D071D94B5B230549F9DC851566DC");
Also if it serves something
$ tree ~/.ssh
├── authorized_keys
├── id_rsa2
├── id_rsa.pub
└── known_hosts
What you need to do is to create a new pgp key with gpg and then use the fingerprint for the public key as the argument for your addencryptkey().
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 351 |
Nodes: | 16 (2 / 14) |
Uptime: | 28:01:03 |
Calls: | 7,634 |
Files: | 12,796 |
Messages: | 5,688,762 |