tools / fw / ota / sign

OTA signing primitive

ota_sign.py reproduces one cryptographic step of the Hisense/VIDAA OTA request format:

signature = URLEncode(base64(RSA_public_encrypt(MD5(content), pubkey, PKCS1v15)))

It is a signing primitive only. It does not build or send requests, does not perform sign-in or version checks, and contains no credentials, device identifiers, tokens, or vendor keys.

Scope and authorised use

Install

The only dependency is optional; the CLI's --help works without it.

python -m pip install -r tools/ota/requirements-ota.txt

If cryptography is missing, signing exits with an install hint.

Usage

python tools/ota/ota_sign.py --pubkey my-public-key.pem --string 'field=value&field2=value2'

The key may instead be supplied through an environment variable (a path, not PEM content):

export HISENSE_OTA_PUBKEY=/path/to/my-public-key.pem
python tools/ota/ota_sign.py --string 'field=value'

--string is hashed as UTF-8 bytes. The output is a single URL-encoded signature on stdout.

Run the built-in round-trip check with a throwaway key generated in memory:

python tools/ota/ota_sign.py --selftest

Extending locally without committing secrets

The public tool intentionally stops at the signing primitive. If you extend it for your own device:

Notes

MD5 plus RSA public-key encryption is the vendor protocol, not a modern signature scheme. Do not reuse this construction for new designs.