Signing and encryption keys
Every key a game project has, what each one protects, which file or machine holds it, and what changes when you replace it.
A game project has two keys of its own, made once with one command, and nothing else to manage. This page lists them, says where each lives and what happens when you replace one. Content protection explains how a package and the game use them.
The project's keys
| Key | Algorithm | Protects | Where it lives | Commit it? |
|---|---|---|---|---|
| Encryption key | XChaCha20, 32 bytes | The content in your .meaf archives | EncryptionKey= in Config/DefaultCrypto.ini; the packager also writes it into the staged game host | Yes. It is shipped inside the game by design. |
| Signing public key | EdDSA (Monocypher, over BLAKE2b) | Lets the game check archives, modules, mods and live-ops config | SigningPublicKey= in Config/DefaultCrypto.ini; embedded in the staged host | Yes |
| Signing private key | EdDSA | Makes those signatures | The per-user key store, or the MOWO_SIGNING_PRIVATE_KEY environment variable on a build machine | Never. |
Make them:
./mbt.cmd crypto generate --project D:/Projects/MyGame/MyGame.mprojectThe command writes Config/DefaultCrypto.ini (the encryption key, its id, the signing public key and the bEncryptPaks / bSignPaks switches) and stores the private key under its public key's name in the key store: %LOCALAPPDATA%\MowoEngine\SigningKeys on Windows, $XDG_CONFIG_HOME/MowoEngine/SigningKeys (default ~/.config) on Linux, ~/Library/Application Support/MowoEngine/SigningKeys on macOS. Commit the INI. Copy the private key file to offline storage: a lost key means you can never sign a patch, DLC or mod update for a build you shipped.
--encryption or --signing makes only that key. Keys that exist are kept. --force replaces them.
A build made with a new encryption or signing key cannot open archives an older build shipped, and the reverse. Patches and DLC for a released game must be made with that game's keys. Use --force before your first release, or when a key was exposed.
| Command | Use |
|---|---|
mbt crypto show --project <p> | Which keys the project has and where its private key was found. Never prints a key. |
mbt crypto import-signing-key --project <p> --file <key> | Put the private key on another machine's key store. It is refused unless it belongs to the project's public key. |
mbt crypto migrate --project <p> | Move a private key out of a DefaultCrypto.ini that still has a SigningPrivateKey= line. |
On a build machine, set MOWO_SIGNING_PRIVATE_KEY to the 128 hex digits of the private key as a CI secret instead of importing it. The variable is only used when it belongs to the INI's public key. MOWO_SIGNING_KEYSTORE moves the key store folder.
What mbt package needs
A release package is encrypted and signed, so it needs the keys. Without them, mbt package refuses and says how to make them. Pass --unprotected to ship plaintext, unsigned content and unsigned modules on purpose. Other configurations protect when the keys exist and ship plaintext when they do not. A release package also refuses a DefaultCrypto.ini that still carries the private key.
Your own modules
With the signing keys present, mbt package signs <Product>.Data/Manifest.json with the same signing key: it lists every module and pack with its sha256. The game checks the signature before it loads a module and refuses an unsigned or altered one. You do not make a separate code-signing key for your game's DLLs.
The engine's own libraries are a different matter and need nothing from you. Mowo Games signs them, the installed engine ships the signed statement MowoEngine.modules.sig beside them, and the game checks it against the engine public key built into Core. A package made from the installed build reuses that statement.
Mods and DLC
- DLC is packed by
mbt package --dlc <Name> --base <dir>with the project's keys, like the base game, so the game accepts it with no extra step. See Patches, chunks and DLC. - Mods.
mbt package-modsigns the mod's pak with one of three keys, in this order:--key <meaf_signing.key>(itsmeaf_signing.pubbeside it);--project <game>.mproject, the game's own signing key, for the studio's official mods; or a key made on first use in the mod's.Mowo/Saved/ModSigning/. A mod author must keep that third key: an update signed with another key is refused by players who already enabled the mod. A mod that carries code or scripts is accepted only when it is signed by the game's key or one listed inmods.TrustedKeys. See Mods and the Workshop. - Live-ops config is signed with
mbt liveops sign <file> --out <signed> --project <p>(or--key), and the game verifies it against its embedded public key. See Live ops.
A standalone key set
MeafBuilder keygen -o <dir> writes meaf_signing.key, meaf_signing.pub and meaf_encryption.key without touching a project, for a mod author or a standalone tool. These files are secrets; keep them out of version control. A project does not use them directly: mbt crypto generate makes the project's pair the same way and files it in the key store.
Rules
- Commit
Config/DefaultCrypto.ini. Never commit a private key, ameaf_signing.keyor ameaf_encryption.key. - Keep an offline copy of the private key and of the INI's keys before the first release.
- Give a build machine the private key through a CI secret (
MOWO_SIGNING_PRIVATE_KEY), not a file in the repository. - Do not replace keys after you ship, unless one was exposed. Expect to repackage everything that depends on the old key.
Related
Engine sources
This page describes behavior implemented in these files of the engine repository, checked against commit 1fd6d4508.
- Engine/Source/Platform/Filesystem/Api/Filesystem/ProjectCryptoSettings.h
- Engine/Source/Platform/Filesystem/Api/Filesystem/MeafKeyRing.h
- Engine/Source/Platform/Filesystem/Api/Filesystem/FModuleSignature.h
- Engine/Source/Platform/Filesystem/Api/Filesystem/EmbeddedCryptoKeys.h
- Engine/Source/Core/Core/Api/Core/ModuleIntegrity.h