Release signature
The vendor key, the sig/ folder with the hash list and signature, the publisher tool, key replacement and error codes.
The vendor creates a key pair and signs every version. The private key never leaves the vendor; only the public key is sent to the server. What is signed is not an archive but the hash list of the version files.
Key
- Algorithm: Ed25519 or RSA of 3072 bits or more. Create the pair with
ssh-keygen, for examplessh-keygen -t ed25519; the private key stays with the vendor. - The key fingerprint on the server (
fingerprint) is the SHA-256 of the raw 32 bytes of an Ed25519 public key (for RSA, of the SSH wire format), 64 hex characters. A fingerprint is unique forever: a key that was ever used cannot be registered again (KEY_ALREADY_USED). - A vendor has exactly one current key at any moment; all applications of the vendor are signed with it.
- A key is registered with
POST /v1/vendor/keys, signed by this same key (X-Key-Id: new): this proves ownership. The first key can also be pasted as text in the developer cabinet, section "Keys".
The sig/ folder
The repository root contains the folder sig/ with exactly three files. The publisher tool creates them; do not edit them by hand.
| File | Contents |
|---|---|
sig/hashes.json | The hash list: file path and SHA-256 for all files of the version except the sig/ folder. |
sig/hashes.json.sig | The signature of the hash list: ssh-keygen -Y sign -n tozade-app. |
sig/key.fingerprint | One line SHA256:…: the publisher key fingerprint in OpenSSH format. |
{
"icon.svg": "<SHA-256>",
"locale/en.json": "<SHA-256>",
"locale/ru.json": "<SHA-256>",
"manifest.yml": "<SHA-256>"
}
The server recomputes the hashes of the commit files: an extra, missing or changed file means rejection. The signature is checked with the current vendor key, and the fingerprint in sig/key.fingerprint must match that key.
Publisher tool
The hash list, signature and fingerprint are produced by the script app-hashes.sh <private key file> from the publisher/ folder of the application server. It takes the version from manifest.yml and the files and their contents from git (the index), not from disk, and refuses if the version is not of the form N.N.N or is not greater than all earlier tags. It needs sh, git and ssh-keygen.
- Raise
versioninmanifest.ymland add the changes to the index:git add. - Fetch the tags the server has set:
git fetch --tags. - Run
sh app-hashes.sh <key>: thesig/files appear. - Commit:
git add sig,git commit. - Send the version:
git push origin test. The server sets the version tag.
The appsign command from the application server code is only for vendor keys and requests: keygen (a new Ed25519 pair), request (request signature headers, including X-Replaces-Signature), proof (replacing a lost key through the administrator). It does not sign releases.
Key replacement
- Create a new pair and send
POST /v1/vendor/keyswith the fieldreplaces(the fingerprint of the current key). - Sign the request with the new key (
X-Key-Id: new) and add the headerX-Replaces-Signature: the signature of the same string by the key being replaced. For Ed25519 keysappsign requestcomputes the headers; for RSA usessh-keygen -Y sign -n tozade-app(signature in base64). - The old key becomes retired, and all vendor applications move to the new one.
Signature errors
| Code | Reason |
|---|---|
PACKAGE_INVALID | The hash list sig/hashes.json, the fingerprint sig/key.fingerprint or the contents of sig/ failed the check. |
RELEASE_SIGNATURE_INVALID | The hash list signature does not match the current vendor key. |
KEY_RETIRED | The key was replaced between the check of the release request and its approval, or replaces points to a retired key. |
VENDOR_KEY_REQUIRED | The vendor has no current key: register a key first. |
KEY_ALREADY_USED | A key with this fingerprint was registered before. |
KEY_REPLACES_REQUIRED | The vendor already has a current key: a new one is registered only as a replacement, with the field replaces. |
REPLACES_SIGNATURE_INVALID | The header X-Replaces-Signature is missing or the signature by the key being replaced does not match. |