Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #18955

Re: gnupg::encrypt(): get_key failed

From Fx ROOM <naso@tata.new>
Newsgroups comp.lang.php
Subject Re: gnupg::encrypt(): get_key failed
Date 2022-05-29 12:07 +0200
Organization Aioe.org NNTP Server
Message-ID <t6vgk9$1nhd$1@gioia.aioe.org> (permalink)
References <t6sljc$1i9$1@gioia.aioe.org> <t6sm26$9bp$1@dont-email.me> <t6t1i1$l52$1@gioia.aioe.org> <jffj5bF3q3oU1@mid.individual.net>

Show all headers | View raw


Il 28/05/22 23:39, J.O. Aho ha scritto:
> 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().

//-----BEGIN SCRIPT-----

/*
  * Installazione estensione
  * $ sudo apt install php-gnupg
  *
  * Generazione chiave
  * $ gpg --gen-key
  */

$gpg = new gnupg();
$key = file_get_contents(__DIR__ . "/../etc/key");
$gpg->addencryptkey($key);

var_dump(
     $gpg->geterror(),
     $encrypted_text = $gpg->encrypt("just a test"),
     $gpg->decrypt($encrypted_text),
);
//-----END SCRIPT-----

bool(false)
string(699) "-----BEGIN PGP MESSAGE-----

hQGMA950B1qyHrK/AQwAm0nogiPFkFzBnYP5CjDUipMkzSXmu0ti9nh1/9gsruZM
HIeehoDQZIPTteY29PqH4t/Ijy59Chl3+CW8Lz1lNycAz0kMDeTRgkxIO7jG7GiQ
BRQ4qH67epZZqAx1xgMRPh/NOR11sqAvARnVUI/UxWUtcLvtjH7huMFSDcyl1+1k
3fpc2wu+u1wBMWvWIsZ7rreJNtSxgbMzZ9/yX8ykORFbDr945CaOxBtejkfPZLmi
3vpjfEiUWimlU8X2C2BLf5VU2rVVJpyp0ZkUJ/dgfNyyoDBUge6jLZkpojHtZBHd
lIdym7BjpAAOCUGWxDEUPZjJyk1Oc3B/j0svC+vymtXpm1VBXVjnGheuHgREV2+c
05a7P9KOhnq/DQ02jMGa/MpMnRaxjwd/rshSlh4PfY6spdLeETglhXn/3iNBpSRE
M42jgYA1h4wb4JyWoojiGgkTR7I3"...
string(11) "just a test"

Good!!!

Back to comp.lang.php | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

gnupg::encrypt(): get_key failed Fx ROOM <naso@tata.new> - 2022-05-28 10:13 +0200
  Re: gnupg::encrypt(): get_key failed De ongekruisigde <ongekruisigde@news.eternal-september.org> - 2022-05-28 08:21 +0000
    Re: gnupg::encrypt(): get_key failed Fx ROOM <naso@tata.new> - 2022-05-28 13:37 +0200
      Re: gnupg::encrypt(): get_key failed "J.O. Aho" <user@example.net> - 2022-05-28 23:39 +0200
        Re: gnupg::encrypt(): get_key failed Fx ROOM <naso@tata.new> - 2022-05-29 12:07 +0200

csiph-web