How to decrypt a symmetric encrypted OpenPGP message using PHP?

I have an OpenPGP message that looks something like this in a file:

-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.9 (MingW32)

jA0EAgMCtCzaGHIQXY9g0sBnAeDOQ9GuVA/uICuP+7Z2dnjNCLgRN0J/TzJs1qcW
aJYBTkH5KQCClCxjwTYbHZCox1sENfIS+KxpCKJQqAX3SNEFm0ORNE6RNwEgb1Zj
uOdIw8auxUsjmQKFLAcZIPKjBjyJqSQVfmEoteVn1n+pwm8RdIZevCHwLF2URStB
nBVuycaxcaxcaxcxccxcxacqweqweqwe123fsMqQPaTusOBGpEQrWC9jArtvYEUpY
aNF6BfQ0y2CYrZrmzRoQnmtnVu10PagEuWmVxCucyhVwlthVgN0iBog9jhjliQkc
rrDTupqB4IimMEjElGUHtkuvrCQ0jQnOHEAJmmefMDH0NkYKGd5Ngt21I5ge5tob
/uBjHKMxjNgg1nWfg6Lz4jqoKe/EweuEeg==
=+N9N
-----END PGP MESSAGE-----

and he was given a 15-character passphrase to decrypt it, I suppose. But I have no idea to decrypt the file using PHP. I look at the PHP GnuPG man page and in the example gnugpg_decrypt()it gives this code:

$res = gnupg_init();
gnupg_adddecryptkey($res,"8660281B6051D071D94B5B230549F9DC851566DC","test");
$plain = gnupg_decrypt($res,$encrypted_text);
echo $plain;

So, looking at this feature gnupg_adddecryptkey, he mentioned that I need a fingerprint. What is it really? And where can I get it?

+4
source share
2 answers

- -, , . gnupg_import fingerprint.

/ , , -, : / ( ), .

PHP GnuPG. , :

- GNU Privacy Guard (GPG).

GPG , .

, gpg. :

gpg --symmetric --decrypt [file]

(, STDIN). GnuPG --passphrase...:

--passphrase-fd n

n. n. 0 n, STDIN.   .

--passphrase-file file

. . , . , , , . , .

--passphrase string

. , . , . , .

, , , --passphrase - no-go.

+7

PHP, GnuGPG. Jens Erat , , , passwords.txt:

// encrypt
gpg --output passwords.gpg --symmetric passwords.txt
// decrypt
gpg —decrypt  passwords.gpg
+1

All Articles