I have to download a program with a PGP signature and a signing key (Public Key)
How do I check the program with signing key?
Assuming you have GPG installed:
gpg --import signing_key.pub
gpg --verify signed_file.sig
Where signing_key.pub is the public key, and signed_file.sig is the detached signature for the file (in the same directory as the signed file).
.asc PGP signature is givenA first attempt to verify the .tar.xz fails, but is nonetheless useful to obtain the RSA key identifier.
$ gpg --verify tor-browser-linux64-9.0.4_en-US.tar.xz.asc
gpg: assuming signed data in 'tor-browser-linux64-9.0.4_en-US.tar.xz'
gpg: Signature made Thu 09 Jan 2020 21:09:44 CET
gpg: using RSA key EB774491D9FF06E2
gpg: Can't check signature: No public key
Now, use the mentioned RSA key identifier to import the missing public key from a key server.
$ gpg --keyserver pgpkeys.mit.edu --recv-key EB774491D9FF06E2
gpg: key 4E2C6E8793298290: 70 duplicate signatures removed
gpg: key 4E2C6E8793298290: 21229 signatures not checked due to missing keys
gpg: key 4E2C6E8793298290: 2 signatures reordered
gpg: key 4E2C6E8793298290: public key "Tor Browser Developers (signing key) <torbrowser@torproject.org>" imported
gpg: marginals needed: 3 completes needed: 1 trust model: pgp
gpg: depth: 0 valid: 1 signed: 1 trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1 valid: 1 signed: 0 trust: 0-, 0q, 0n, 1m, 0f, 0u
gpg: next trustdb check due at 2021-12-08
gpg: Total number processed: 1
gpg: imported: 1
The second verification attempt now succeeds.
$ gpg --verify tor-browser-linux64-9.0.4_en-US.tar.xz.asc
gpg: assuming signed data in 'tor-browser-linux64-9.0.4_en-US.tar.xz'
gpg: Signature made Thu 09 Jan 2020 21:09:44 CET
gpg: using RSA key EB774491D9FF06E2
gpg: Good signature from "Tor Browser Developers (signing key) <torbrowser@torproject.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: EF6E 286D DA85 EA2A 4BA7 DE68 4E2C 6E87 9329 8290
Subkey fingerprint: 1107 75B5 D101 FB36 BC6C 911B EB77 4491 D9FF 06E2
If that didn't work you can fetch the public key and import it into gpg.
curl -s https://openpgpkey.torproject.org/.well-known/openpgpkey/torproject.org/hu/kounek7zrdx745qydx6p59t9mqjpuhdf |gpg --import -
and then verify the file.
gpg --verify tor-browser-linux64-9.0.10_en-US.tar.xz.asc