Checking a key is signed
The short answer is that you use the command gpg --list-sig <key id>
.
For example, I went to the site you listed above and downloaded the qubes release 2 signing key. I then imported that key into my local gpg keyring:
$ gpg --import qubes-release-2-signing-key.asc
which results in the following
pub rsa4096/0A40E458 2012-11-15 [SC]
uid [ unknown] Qubes OS Release 2 Signing Key
To check if the key has been signed, you can use the command gpg --list-sig <key id>
.
In this case, we can see that the key ID is 0A40E458
from the output above:
$ gpg --list-sig 0A40E458
pub rsa4096/0A40E458 2012-11-15 [SC]
uid [ unknown] Qubes OS Release 2 Signing Key
sig 3 0A40E458 2012-11-15 Qubes OS Release 2 Signing Key
sig 36879494 2012-11-15 [User ID not found]
The last entry is the Qubes master key, but it is unknown as I don't have it on my keyring. If I then download the master key, and add it to the keyring:
$ gpg2 --import ./qubes-master-signing-key.asc
gpg: key 36879494: public key "Qubes Master Signing Key" imported
gpg: Total number processed: 1
gpg: imported: 1
I can verify again and see that the release key is correctly signed:
$ gpg2 --list-sig 0A40E458
pub rsa4096/0A40E458 2012-11-15 [SC]
uid [ unknown] Qubes OS Release 2 Signing Key
sig 3 0A40E458 2012-11-15 Qubes OS Release 2 Signing Key
sig 36879494 2012-11-15 Qubes Master Signing Key
Verifying signatures
When a file is signed using a gpg key, a separate signature file is created. With the qubes example, they release a .DIGESTS
file. See the heading 'Verifying Digests' in the link you provided for more details on how to check such a digest.
Basically, what they have done is taken the file that is purported to come from them, and run a variety of hash algorithms against it. A hash function will take an input file or message, and output a unique fairly short hash string. This is cryptographically created in way that makes it very difficult or nearly impossible to find any other file that would produce the same output.
They then sign this hash string with their GPG key. Both the hash and the signature of that hash text are put inside the .DIGESTS file.
The important part to note with this process is that any change to the original file being verified will produce a completely different hash string. Therefore, when you run the verification command, what is happening on your local machine is that your system is creating it's own hash of the given file and checking that it matches the hash inside the signed text. If they both match, and the signature is verified as coming from the key you have already decided to trust, then you know that the owner of the key has 'signed' the version of the file that you have downloaded.