Code signing utility for GmodDotNet powered by NSec and libsodium.
GmodNetModuleSigner (or just gms for short) is command line tool for code signing of Garry's Mod .NET modules. gms signs code with Ed25519 digital signature algorithm based on Twisted Edwards curves cryptography.
In general, gms creates a module signature by private key from module's SHA-512 checksum and version. Resulting signature can be verified by public key to ensure that module was compiled by original author and wasn't modified.
-
Get the latest
gmsbuild from the releases page. -
If you are using Linux or Mac Os, ensure that
gmsexecutable has execution privileges (by runningchmod +x gms). -
If you don't have a public-private key pair, generate one by running
gmswith--generate-keyflag:
$ ./gms --generate-keygms will write a key pair to private.modulekey fail, which is just a JSON document of form
{
"PrivateKey": "FE958AACDE44A0F90AE2D8F1595EB61DA060A5E09D9D5EB72DA86CD5801AE420",
"PublicKey": "3E94D3C8823B20DF9FF63DC0D82DC8C1201ACF72F065167553C12A54E1262188"
}It is a good practice to have an individual private key for each project you develop. NEVER publish your *.modulekey file with PrivateKey field in it. Keep this pair secret.
- Let's say you want to sign a
SimpleModule.dllmodule withgms. Then you should rungmsas following:
$ ./gms --sign=[full_or_relative_path_to_SimpleModule.dll] --key=[path_to_your_pruvate_public_key_pair_file] --version=[string_version_of_your_module]Version can be any string, but it is an good idea for it to be of the form X.Y.Z, since GmodDotNet works only with versions of such format. gms will generate a signature.modulekey JSON file of the following form:
{
"Version": "1.2.0",
"Signature": "F00200AF95CFED2CD5FD0F2959FB352BEF22609E2C24F76474B24A56627CEFDEFC4D8ACCF8B76F7B326357D428575EB02DF321D9694056AD64A443E30B66C400"
}This file does not contain any secret data and designed to be distributed publicly.
-
Rename
signature.modulesignto[your_module_name].modulesign(likeSimpleModule.modulesign). -
Copy
private.modulekey, rename it to[your_module_name].modulekey, and DELETEPrivateKeyfield from it.*.modulekeyfiles withoutPrivateKeyfield are safe to publish. -
Place
[your_module_name].modulesignand[your_module_name].modulekeywith your module distribution. GmodDotNet will use this files to verify that client has valid version of module. -
You can verify signatures with
gms:
$ ./gms --verify=[path_to_file_to_verify] --key=[path_to_modulekey_file] --signature=[path_to_modulesign_file]In case of verification *modulekey file can contain only PublicKey field.
- You can always get usage help from
gmsby running
$ ./gms --helpJoin our discord server.