In this question I asked about how to handle situations when SHA-256 hashes are not available for a file downloaded from the internet that contains executable code. Another community member insightfully asked if a hash is really needed to validate the download (in this case, LibreOffice), since it is a digitally signed file.

I don't know the answer to that good question, so I thought it best to ask it here: If a file is digitally signed, is it important to also have a good hash (such as SHA-256) to help validate the file?

One of my concerns is that is is trivially simple to create strings of text that look nearly identical (and in some cases completely identical), but are actually different (often by using various Unicode characters). For a digital signature to be secure, it would require sufficient safeguards to prevent this type of attack.

  • It's not necessary, but it is good form. Some people may only care about integrity because they worry about accidental changes, rather than malicious changes.
    – user163495
    Commented Jun 11, 2021 at 14:41
  • @MechMK1 accidental changes can be detect with Digital Signature as well. How hash can help with extra security? May be just for the sake of self satisfaction or is there any use case I'm missing?
    – saurabh
    Commented Jun 11, 2021 at 14:53
  • @saurabh Yes, but they also require me to setup gpg, import a key from somewhere, verify that it's the correct key, set that I trust that key, etc.. A plain hash on the other hand is easier to work with.
    – user163495
    Commented Jun 11, 2021 at 15:21

1 Answer 1


I do not think so. Forging Code signing signature is infeasible whereas hashes can be updated to match the uploaded binary. If the website, which is providing you, the download is compromised than hashes can also be changed. This is not possible with digital signature and you at least need signing key access.

So, Digital Signature is sufficiently secure at least more secure than providing the hashes. Digital Signature uses PKI (Publick Key infrastructure) for verification of signatures. You can read it more over here Digital Verification

For signing binaries like msi you will need code-signing certificates which can be issued by trusted CA's or CA you trust. You will sign the binaries with signing keys (Private Keys). There are measures in place to secure these signing keys like storing it in Hardware Security Module HSM, TPM etc.

Trusted third party CA's do not sign code-signing keys without checking the security of keys or else they provide security hardware themselves before releasing the keys like Tokens (this depends on type of code signing certificate as well for e.g. EV code signing certs). There are other measures as well like physical verification or organization level verification. The process is quite good.

However, there is no way to find if code-signing keys signed by CA are compromised until the vendor release a statement and inform CA which in turn release the CRL (Certificate revocation list).

Before you verify the digital signature, you can ensure that:

  1. Integrity of the system where you verify the binaries is intact.
  2. System is regularly updated with latest patch specifically certificate/CRL from trusted source such as Microsoft.

Because of the key security measures and other verification measures you only trust the trusted third parties CA like DigiCert, QuoVadis etc.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .