I have a question about DSA and GPG. Suppose you are trying to verify a downloaded file is 'legit' (i.e., no malicious code and it is the intended file). I'll just use Ubuntu's 16.04 LTS ISO image as an example. Following through the instructions, I get the general idea (please correct if I am wrong):
- Download the ISO, the SHA256 file and the SHA256 file signature
- Get the Ubuntu public key from the key server
- Verify that the SHA256 file was signed using the Ubuntu private key with the public key using DSA.
- Compute the hash of the ISO and compare the hash with the hash in the SHA256 file.
Now, maybe a stupid question, but couldn't an attacker instruct you to download his own key instead of Ubuntu's, a malicious ISO, the hash of the malicious ISO, and a valid signature of the hash of the malicious ISO? I guess a simple way to defend against this is just cross-compare the public key against a bunch of different sites (as this key has been around forever), but what if the public key is not as well known. If the site is fully compromised, I feel like the attacker could trick you into downloading the wrong key!