S-63 encrypted ENC
S-63 is the IHO Data Protection Scheme for ENC: cells are compressed, encrypted with a cell key, and signed; a customer receives cell permits that unlock the keys only on one installation, identified by its hardware id (HW_ID). Loka decrypts S-63 exchange sets when it has a hardware id and the permits for it; real permits need the steps under Still needed.
How it works (1.5.0)
Section titled “How it works (1.5.0)”- Hardware id.
LOKA_S63_HW_ID(five hexadecimal characters) in the server’s environment. Treat it as a secret: anyone with it and a permit file can decrypt the cells. Without it, S-63 uploads are refused with422 S63_NOT_SUPPORTEDand a summary of what they hold. - Import. Console → ENC Charts → the exchange set as one ZIP file that includes the
PERMIT.TXTissued for this hardware id. Each encrypted cell file (base and updates) is decrypted with the keys of its permit (the first key, then the second), unzipped, and built like any S-57 cell. The answer’ss63part lists the cells decrypted, the cells whose permit has expired (they are decrypted and drawn, with a warning) and the cells left out with the reason (no permit,SSE 13permit for another system, wrong key). When no cell can be decrypted the import fails with422 S63_DECRYPTION_FAILED. - Decrypted data exists only in the private staging folder of the import and in the built chart; the encrypted upload is removed.
- Code.
internal/enc/s63crypt.go: Blowfish (its tables, the hex digits of pi, generated inblowfish_tables.go; no third-party package), user permits (MakeUserPermit,HardwareID), cell permits (MakeCellPermit,CellKeys), cells (EncryptCell,DecryptCell).internal/enc/s63set.go:DecryptExchangeSetZIP.internal/enc/s63.go: recognition and the permit file parser. TheMake…andEncrypt…functions are the data server’s side, used for tests and test data.
Checked
Section titled “Checked”- Blowfish against Eric Young’s published test vectors.
- The worked examples of the S-63 standard: the user permit
66B5CBFDF7E4139D5B6086C23130(HW_ID 12345, M_KEY 10121, M_ID 3130) and the cell permitNO4D061320000830BEB9BFE3C7C6CE68B16411FD09F96982795C77B204F54D48(HW_ID 12348, cell keys C1CB518E9C and 421571CC66) come out character for character, and the keys are read back. - End to end on the demo: the NOAA cell US1GLBAA, encrypted with a made-up cell key and permit for a test hardware id, imported through the ENC upload, decrypted, built and drawn.
- The reference server’s S-63 tool reads the same permits from a permit file.
Still needed
Section titled “Still needed”- OEM registration. Real permits are ordered with a user permit, made from the hardware id
with a manufacturer key (M_KEY) and id (M_ID) that the IHO Scheme Administrator gives to a
registered OEM. Without registration no data server issues permits for a Loka installation.
With it, the console can show the user permit (
MakeUserPermit); the M_KEY stays out of the repository. - Signatures. Check each cell’s signature file against the data server’s certificate, and
that certificate against the Scheme Administrator’s (
IHO.CRT), with DSA. Not done yet: cells are decrypted without this check. - Permit store. Permits kept on the server (table, keys encrypted at rest, list and delete), so an update exchange set can be imported without its permit file.
- Messages. All S-63 SSE codes and texts; only
SSE 13is used so far. - Licence. Charts built from S-63 data should not be made public or downloadable as data.
Validation still to do
Section titled “Validation still to do”- The IHO S-63 test data set (test hardware id, permits, signed and encrypted cells, expected messages), once its download is approved.
- The same exchange set in the reference server’s S-63 tool (
create-db,import-permit,register-exchange-sets) for permit counts, warnings and the drawn chart.