Frostberg Chassisportal
Internal tooling

frostberg_calsign.py

The internal calibration signer. Field engineers use it to sign a bundle for a specific module before pushing it.

# frostberg_calsign.py   (Frostberg internal calibration signer)
#
# Signs a calibration bundle for the ESC module. The signing key is
# tied to the specific module: it is derived from the module serial,
# which is stamped on the module and reported in the car's diag data.
import hmac, hashlib

def _bundle_key(module_serial):
    return (module_serial[::-1] + ':kalibr').encode()

def sign(module_serial, vin, action='esc:disable'):
    msg = f'{action}:{vin}'.encode()
    return hmac.new(_bundle_key(module_serial), msg, hashlib.sha256).hexdigest()