Skip to content
TOZADE
Country: Jamaica
Language: English

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 example ssh-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.

FileContents
sig/hashes.jsonThe hash list: file path and SHA-256 for all files of the version except the sig/ folder.
sig/hashes.json.sigThe signature of the hash list: ssh-keygen -Y sign -n tozade-app.
sig/key.fingerprintOne 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.

  1. Raise version in manifest.yml and add the changes to the index: git add.
  2. Fetch the tags the server has set: git fetch --tags.
  3. Run sh app-hashes.sh <key>: the sig/ files appear.
  4. Commit: git add sig, git commit.
  5. 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

  1. Create a new pair and send POST /v1/vendor/keys with the field replaces (the fingerprint of the current key).
  2. Sign the request with the new key (X-Key-Id: new) and add the header X-Replaces-Signature: the signature of the same string by the key being replaced. For Ed25519 keys appsign request computes the headers; for RSA use ssh-keygen -Y sign -n tozade-app (signature in base64).
  3. The old key becomes retired, and all vendor applications move to the new one.

Signature errors

CodeReason
PACKAGE_INVALIDThe hash list sig/hashes.json, the fingerprint sig/key.fingerprint or the contents of sig/ failed the check.
RELEASE_SIGNATURE_INVALIDThe hash list signature does not match the current vendor key.
KEY_RETIREDThe key was replaced between the check of the release request and its approval, or replaces points to a retired key.
VENDOR_KEY_REQUIREDThe vendor has no current key: register a key first.
KEY_ALREADY_USEDA key with this fingerprint was registered before.
KEY_REPLACES_REQUIREDThe vendor already has a current key: a new one is registered only as a replacement, with the field replaces.
REPLACES_SIGNATURE_INVALIDThe header X-Replaces-Signature is missing or the signature by the key being replaced does not match.

This site uses cookies: sign-in and the choice of country, language and theme rely on them. Cookie Policy