$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: | 379 |
Nodes: | 16 (2 / 14) |
Uptime: | 83:57:07 |
Calls: | 8,091 |
Files: | 13,069 |
Messages: | 5,851,128 |