Files
OrbitTv/docs/SIGNING-KEY-BACKUP.md
T
2026-11-08 10:17:37 +00:00

5.6 KiB

Orbit TV: signing key backup and recovery

Written 8 November 2026 (audit finding U1 / S2). This file has no secrets in it: no key material and no passwords. It is safe to keep in git.

Why it matters

Android installs an update only if it's signed with the same key as the installed copy. Every Orbit build on the downstairs and upstairs TVs is signed with one key.

If that key is lost, no future build can install over them. The only way forward would be to uninstall Orbit, which wipes everything on the TV, because allowBackup is off. A new key can't be swapped in later without the old one, because key rotation needs both.

What must be backed up

Item Where it is now Secret? How to back it up
The keystore file orbit-tv/.tooling/android/debug.keystore (2,618 bytes, PKCS12, created 31 Oct 2026) Yes: holds the private key Encrypted copies only (below)
Keystore password and key password The standard Android debug-keystore defaults (both the same) Treat as secret alongside the file Password manager entry "Orbit TV signing key"
Key alias androiddebugkey No This file and the password manager entry
Encryption passphrase for the backups Chosen by Paul when the backups are made Yes Password manager only, never on the same USB stick

Public facts, for checking a recovered key (not secret)

  • Certificate DN: C=US, O=Android, CN=Android Debug
  • RSA 2048-bit, SHA256withRSA, valid 31 Oct 2026 to 23 Oct 2056
  • Certificate SHA-256: 042f963772f0b6f8b983742287f9487d7e2cfc8491676966c60297d3390558e1
  • The installed 0.108.104 APK verifies with APK Signature Scheme v2 and this same certificate.

Making the two encrypted offline backups (Paul does this, or approves it step by step)

Tools already on this PC: gpg (for AES-256 symmetric encryption) and cryptsetup.

  1. Choose a strong passphrase (5 random words or more) and save it in the password manager, together with:
    • the alias
    • the keystore password note
    • the certificate SHA-256 above
  2. Make one encrypted file. gpg asks for the passphrase itself, so it never appears on the command line:
    gpg --symmetric --cipher-algo AES256 --output ~/orbit-signing-key.p12.gpg /home/pauljd/Documents/OrbitTV/orbit-tv/.tooling/android/debug.keystore
    
  3. Backup 1: copy orbit-signing-key.p12.gpg to USB stick A. Store the stick away from the PC.
  4. Backup 2: copy the same .gpg file to a second offline place: USB stick B, or the password manager's file attachment if it encrypts end to end. Keep it somewhere other than stick A.
  5. Delete the working copy in your home folder:
    shred -u ~/orbit-signing-key.p12.gpg
    
    The original keystore stays where it is.

Checking recovery safely (do this once for each backup)

This decrypts into memory only (/dev/shm), compares, then wipes. It never writes the key to disk.

gpg --decrypt --output /dev/shm/orbit-check.p12 /media/<stick>/orbit-signing-key.p12.gpg
keytool -list -v -keystore /dev/shm/orbit-check.p12 -alias androiddebugkey | grep 'SHA256:'
shred -u /dev/shm/orbit-check.p12

Pass means the printed SHA256 matches 04:2F:96:37:72:F0:B6:F8:B9:83:74:22:87:F9:48:7D:7E:2C:FC:84:91:67:69:66:C6:02:97:D3:39:05:58:E1. keytool asks for the keystore password.

Restoring after a loss

  1. Decrypt one backup to orbit-tv/.tooling/android/debug.keystore.
  2. Run the check above against it.
  3. Build as usual. apksigner verify --print-certs on the new APK must show the SHA-256 above before installing on a TV.

Small hardening, optional and reversible

  • The keystore file is currently readable by the group (-rw-rw-r--). Make it owner-only:
    chmod 600 /home/pauljd/Documents/OrbitTV/orbit-tv/.tooling/android/debug.keystore
    
  • Later (audit S2): create a dedicated release key and rotate to it with apksigner rotate. Back it up the same way first. Both TVs need Android 9 or later; downstairs is Android 14.

Status

8 November 2026, backup 1 made. At Paul's request, the keystore was encrypted to the existing "Fourth Built Hub backups" gpg key, so no passphrase was typed or seen.

  • Public-key encryption, encryption subkey FB1C 8591 1CA9 BF9D 7746 DCC0 ACDD 3E43 2E78 943B.
  • Written as Orbit-TV-signing-key/orbit-signing-key.p12.gpg (2,711 bytes) on the Forth Built backup USB stick (exFAT, 29 GB).
  • No unencrypted copy was written anywhere.

Recovering it needs:

  1. that gpg private key, which lives in ~/.gnupg on this PC;
  2. the key's passphrase.

So the Forth Built gpg private key must itself be backed up off this PC, or this copy can't be opened if the PC is lost.

Still to do:

  • Check backup 1 Done 8 Nov 2026, 09:55: Paul decrypted it to memory and it was byte-identical to the original (MATCH).
  • Make backup 2: on a different medium, using the passphrase method above.

To check backup 1, run this with the stick mounted:

gpg --decrypt --output /dev/shm/orbit-check.p12 /run/media/pauljd/6FCC-BCBD/Orbit-TV-signing-key/orbit-signing-key.p12.gpg && cmp /dev/shm/orbit-check.p12 /home/pauljd/Documents/OrbitTV/orbit-tv/.tooling/android/debug.keystore && echo MATCH; shred -u /dev/shm/orbit-check.p12

8 November 2026, backup 2 made and verified:

  • A Bitwarden secure note (hosted, EU).
  • AES-256 gpg-encrypted with a separate recovery passphrase, which is kept on paper.
  • It holds the signing key and, wrapped the same way, the Fourth Built gpg key.
  • Paul decrypted both and got MATCH. No plaintext or staging copies were left behind.

Recovery paths: the stick with the Fourth Built passphrase, or Bitwarden with the recovery passphrase. Either one is enough on its own.