kb:file_hashes_and_cryptographic_signatures

File Hashes and Cryptographic Signatures

(Hier ist eine deutsche Version dieses Textes)


Integrity of a downloaded software package can be verified by a cryptographic hash, or even a cryptographic signature, if such a hash or signature has been generated by the maintainer of the software package and made available in a hash or signature file associated with the software package.


File hashes can only be used to check the integrity of a file to ensure that the file has not been modified by a third party.

Cryptographic signatures provide additional information about who created the signature and when it was created, which makes it possible to check the authenticity of a file, i.e. whether it really comes from a trustworthy source.


File Hashes can be used to check the integrity of a file. Different hash functions can be used, which offer different levels of security. Currently, the SHA256 and SHA512 hash functions are considered secure enough to ensure file integrity. Older methods such as SHA1 or MD5 should no longer be used because they are considered too insecure.

Meinberg provides additional SHA512SUM or SHA256SUM files for some download files, e.g. for the Meinberg driver package for Linux, which is available as Git-Repo and alternatively as source code archive with associated signature files.


On Linux and other Unix-like systems, the tools to create or check a hash are usually pre-installed, so you can simply run a command in a terminal window, e.g.:

sha512sum -c mbgtools-lx.tar.gz.sha512sum
mbgtools-lx.tar.gz: OK

Similar with SHA256 checksums, where you just have to replace sha512 with sha256.


For Meinberg program packages for Windows, it is actually not necessary to have file hashes and check them, as they are already with digital signatures are provided.

Nevertheless, SHA512 or SHA256 hashes are also offered for some packages for Windows, because with these it is very easy to check the integrity of a package immediately after a download.


On Windows systems, programs such as sha256sum or sha512sum are also available if program packages such as git for Windows or the MSYS/MinGW programming environment are installed, and you open an associated command line window.

The procedure is then the same as described for Linux.


Checking a File Hash with 'PowerShell'

Current Windows versions (e.g. Windows 10 and newer) offer a command in PowerShell that can be used to create or check a file hash.

GetContent dkwin.exe.sha256sum
Get-FileHash dkwin.exe -Algorithm SHA256

The first command displays the hash originally generated for the file dkwin.exe and stored in the file dkwin.exe.sha256sum. The file extension indicates that the SHA256 algorithm was used to calculate the hash value.

The second command calculates the hash for the present file dkwin.exe, whereby it is important that the same algorithm is used, here SHA256.

The file dkwin.exe does not differ from the original file if both hash values displayed are identical, although the upper/lower case of the displayed hashes may differ.


Checking a File Hash with 'certUtil'

In older Windows versions (e.g. Windows 7), the PowerShell command mentioned above is not yet available. On such systems, the certUtil command can be used in a normal command line (cmd.exe) to create or verify a file hash:

type dkwin.exe.sha256sum
certUtil -hashfile dkwin.exe SHA256  | findstr /v “hash”

The first command displays the hash stored in the hash file dkwin.exe.sha256sum, which was generated for the dkwin.exe file using the SHA256 algorithm.

The second command calculates the hash for the local copy of the file dkwin.exe, whereby it is important that the same algorithm is used, here SHA256.

The file dkwin.exe does not differ from the original file if both hash values displayed are identical, although the upper/lower case of the displayed hashes may differ and there may be spaces in the output of the certUtil command.


GnuPrivacyGuard (GnuPG or GPG) is an open source alternative to the proprietary software PrettyGoodPrivacy (PGP). Both implement cryptography with public key functionality as defined by openPGP (RFC4880).

Public key cryptography uses key pairs consisting of a private and a public key.

As the name suggests, the private key must only be accessible to the owner of the key pair, who can use it, for example, to create a cryptographic signature on a file.

The signature is often stored in an additional file that has the same base name as the original file but with an additional extension. This signature file is then passed along with the original file.

The appended filename extension is often .sig if the signature is in binary format, or “.asc” if the signature is saved in a specific ASCII text format. There is no difference in functionality, though.


To verify the signature, the public key associated with the private key used to create a signature must be used. Therefore, the public key, as the name suggests, should be publicly available and easy to find.

Public keys are very often available on the openPGP project's public key server:


Linux and other Unix-like systems usually have the gpg program preinstalled, so you can simply run the gpg command with appropriate options in a terminal window, e.g.:

$ gpg --verify mbgtools-lx.tar.gz.sig
gpg: assuming signed data in 'mbgtools-lx.tar.gz'
gpg: Signature made Wed Dec 20 12:10:39 2023 CET
gpg:                using RSA key 078BED723084EACF649E2FB041721C0C7509F9C8
gpg:                issuer “martin.burnicki@meinberg.de”
gpg: Good signature from "Martin Burnicki (Meinberg Funkuhren GmbH & Co. KG) " [ultimate]

In the example above, the required public key is already available locally and the verification is successful. Otherwise, a warning will be displayed and the missing key must first be imported.


Importing the Required Public Key

If the key used to create the signature is not known to the system running the command, an associated error will appear:

$ gpg --verify mbgtools-lx.tar.gz.sig
gpg: assuming signed data in 'mbgtools-lx.tar.gz'
gpg: Signature made Wed Dec 20 12:10:39 2023 CET
gpg:                using RSA key 078BED723084EACF649E2FB041721C0C7509F9C8
gpg:                issuer “martin.burnicki@meinberg.de”
gpg: Can't check signature: No public key

In this case, a key with ID 078BED723084EACF649E2FB041721C0C7509F9C8 was used to create the signature, but the public key is not yet available locally.


Typically, public keys can be downloaded from a key server. The key server to be used can optionally be specified on the command line:

$ gpg --keyserver hkps://keys.openpgp.org --receive-keys 078BED723084EACF649E2FB041721C0C7509F9C8codedoc:<b>imported: 1</b>~~


Once the GPG key has been imported, the file signature can be verified:

$ gpg --verify mbgtools-lx.tar.gz.sig
gpg: assuming signed data in 'mbgtools-lx.tar.gz'
gpg: Signature made Wed Dec 20 12:10:39 2023 CET
gpg:                using RSA key 078BED723084EACF649E2FB041721C0C7509F9C8
gpg:                issuer “martin.burnicki@meinberg.de”
gpg: Good signature from “Martin Burnicki (Meinberg Funkuhren GmbH & Co. KG) ” [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: 078B ED72 3084 EACF 649E  2FB0 4172 1C0C 7509 F9C8

However, a WARNING: appears above because gpg doesn't know whetherthe imported key is trustworthy.


Trusting a Newly Imported Public Key

Only if it is really certain that the key actually belongs to the alleged owner should the trust level of the key be increased to, for example, 5, ultimate, which means that the warning disappears.

To do this, the following interactive command can be executed:

gpg  --edit-key 078BED723084EACF649E2FB041721C0C7509F9C8 trust

Afterwards, verification of the signature should work without warning, as shown at the beginning.


File hashes are actually not necessary for program packages from Meinberg for Windows, since software packages such as the driver software for Windows or the NTP installer for Windows, are usually fully cryptographically signed.

This means that every individual executable program included in those packages as well as the installation programs themselves have been signed using a cryptographic certificate issued by a global certification authority that has been authorized by Microsoft.

Unlike using PGP/GPG Signatures, there is no need to first import the public key of the signature creator, as there is an entire certificate chain from the certificate used to create the signatures to the root certificate from Microsoft.

So this is in fact even more secure than a simple file hash, and there's no need for an extra file hash.

Anyway, for some Windows packages there's also a SHA512 or SHA256 checksum available because it's very easy to check the integrity of a file using such a checksum.


Windows automatically verifies digital signatures anyway, but the signature can also be verified manually. To do this, right-click on the file to be checked in the File Explorer, select Properties and click on the Digital Signatures tab. If you select one of the signatures there and click on the Details button, a new window will pop up that shows whether this signature is valid or not.

If the Digital Signatures tab is not displayed in the properties window, there is no digital signature attached to the file and therefore the integrity of the file cannot be verified in this way.


Martin Burnicki martin.burnicki@meinberg.de, last updated 2024-02-15

  • kb/file_hashes_and_cryptographic_signatures.txt
  • Last modified: 2024-03-06 09:36
  • by 127.0.0.1