Signing EXEs with SHA-256 is the mandatory standard for modern Windows environments, while SHA-1 is deprecated and actively rejected by security policies. Although some legacy systems or specific enterprise configurations might still require SHA-1 support, relying on it introduces significant security risks and compatibility issues with current certificate authorities. The recommended approach is to use SHA-256 exclusively unless you have a verified need for backward compatibility with very old operating systems like Windows XP or Server 2003.
The Decline of SHA-1 in Software Signing
For years, SHA-1 was the default hashing algorithm used in PKCS#7 signatures generated by tools like
signtool.exe. However, due to demonstrated vulnerabilities that allow collision attacks, major browser vendors and Microsoft have moved to deprecate SHA-1 certificates. If you attempt to sign an executable with a SHA-1 certificate today, you will likely encounter errors from your Certificate Authority (CA) or warnings from end-users regarding untrusted publishers.
Microsoft has explicitly stated that SHA-1 code signing certificates are no longer valid for trust validation in modern versions of Windows. This means that even if a signature is technically valid cryptographically, the operating system may not display the "Verified Publisher" name or may flag the software as potentially unsafe. Consequently, generating signatures with SHA-1 is no longer considered a best practice and should be avoided for any new development or distribution channels.
Why SHA-256 is the Current Standard
SHA-256 provides a significantly higher level of security against collision attacks compared to SHA-1. It is supported natively by all modern versions of Windows, including Windows 10, Windows 11, and recent server editions. When you sign an executable using SHA-256, the signature is recognized as trustworthy by both the OS and major antivirus engines without triggering additional warnings.
Using SHA-256 also ensures compliance with industry standards set by the CA/Browser Forum and other security bodies. Most commercial Code Signing Certificates now only issue SHA-256 or stronger algorithms. Attempting to force SHA-1 support often requires disabling security features or using outdated toolchains, which can expose your build process to other vulnerabilities.
Handling Legacy Compatibility Needs
There are rare scenarios where you must support extremely old hardware or software that cannot parse SHA-256 signatures. In these cases, you might consider maintaining separate builds or using dual-signing techniques. However, note that many modern signing tools and USB tokens do not easily support creating multiple hashes in a single signature file efficiently.
If you absolutely must support legacy systems, you can sometimes configure your signing script to create two separate signature files or use older versions of
signtool.exe that allow specifying the hash algorithm explicitly. Be aware that this increases the complexity of your deployment pipeline and may confuse users who see conflicting signature information. For most developers, supporting Windows 7 and above makes SHA-256 sufficient, as these systems fully support SHA-256 signatures.
Configuring Signtool for SHA-256
To ensure your executables are signed correctly, you must configure your build scripts to explicitly request SHA-256 hashing. By default, newer versions of
signtool.exe may attempt to use SHA-256, but it is safer to specify it manually to avoid fallback behavior. You can achieve this by adding the
/fd sha256 flag to your command line arguments when invoking the signing tool.
For example, a typical command might look like this:
signtool sign /fd SHA256 /f MyCertificate.pfx /p Password MyApplication.exe
This command forces the tool to use the SHA-256 file digest. If you are using a CI/CD pipeline, ensure that your environment variables and build agents are updated to use the latest version of the signing tools, which default to stronger algorithms. Always verify the resulting signature using
signtool verify /pa MyApplication.exe to confirm that the correct hash algorithm was applied.
Security Implications of Weak Hashes
Continuing to use weak hashing algorithms like SHA-1 exposes your organization to potential supply chain attacks. An attacker who can generate a malicious binary with the same hash as a legitimate one could substitute the file without invalidating the signature. While such attacks are complex, they are theoretically possible and have been demonstrated in research settings.
Furthermore, using weak hashes can damage your brand reputation. Users and enterprises increasingly rely on digital signatures to verify the integrity and origin of software. A signature that triggers security warnings or fails to show a publisher name can lead to decreased download rates and increased support tickets. Investing in proper SHA-256 signing practices is a small cost compared to the risk of compromise.
For more details on managing secure connections and troubleshooting related network issues, you might find
DNS and NSLOOKUP: Troubleshooting Network Connectivity Issues helpful for ensuring your build servers can communicate securely with certificate authorities. Additionally, understanding how to manage local resources effectively can aid in setting up isolated signing environments, similar to methods discussed in
Creating Network Load on Local Wi-Fi from One PC.
Frequently Asked Questions
Can I sign an EXE with both SHA-1 and SHA-256?
Yes, it is technically possible to include multiple hashes in a single signature container, but it is rarely supported by modern signing tools and USB tokens out of the box. This approach increases file size and complexity without providing significant benefit since SHA-1 is already considered insecure. Most CAs will not issue certificates that support both for new requests.
Will SHA-256 signatures work on Windows XP?
No, Windows XP does not support SHA-256 code signing by default. It requires specific updates and patches to recognize SHA-256 signatures. If you must support XP, you are forced to use SHA-1, but this severely limits your ability to distribute software on modern platforms. Consider dropping support for XP entirely as it reached end-of-life years ago.
How do I check which hash algorithm my EXE was signed with?
You can use the
signtool verify /pa command followed by the executable name. The output will display detailed information about the signature, including the hash algorithm used for the file digest. Look for the "File Digest" section to confirm whether it is SHA-256 or SHA-1.
Is SHA-384 better than SHA-256 for signing?
SHA-384 offers a larger hash size, but SHA-256 is already considered cryptographically strong enough for code signing purposes. There is no practical advantage to using SHA-384 for EXE signing in terms of security or compatibility. SHA-256 is the widely accepted standard that balances security with performance and broad OS support.
What happens if I use a SHA-1 certificate on Windows 11?
Windows 11 will likely reject the trust chain associated with a SHA-1 certificate, displaying warnings to the user that the publisher cannot be verified. Even if the signature is mathematically valid, the OS security policy will treat it as untrusted. This can result in SmartScreen filters blocking the application or requiring additional user clicks to run.