feat(protocol): add pure OwnerPSK derivation - #45
Conversation
8970113 to
79493fb
Compare
|
I checked this against the IoTivity source rather than against the tests, all looks good. Two non-blocking notes. The tests are named The table also omits the three other suites IoTivity maps to 96: Scope is right. Deterministic derivation with no session access, no writes, no persistence, and no caller yet. Merging. |
|
Followed up in #46. The two tests are now named as synthetic regression vectors, with a short provenance note explaining that they are not captures and do not independently prove the key-block lengths. The derivation docstring also calls out the three other 96-byte IoTivity mappings that are intentionally outside the manufacturer-certificate allowlist. No behavior change. |
Implements the pure OwnerPSK portion agreed in #28.
After an authenticated manufacturer-certificate session, IoTivity derives the 128-bit OwnerPSK in two stages:
The new helper keeps every security-relevant input explicit and validates the exact TLS/OCF shapes before deriving anything. It accepts the eight IoTivity cipher names and matching key-block lengths used by pyOpenSSL, rejects nil UUIDs and unknown ciphers, and requires the caller to choose either the standard manufacturer-certificate label or the confirmed-manufacturer label. The documentation calls out that the label comes from the selected DOXM OXM, not the appliance model.
The PRF ordering and key-block table follow IoTivity’s CAsslGenerateOwnerPsk implementation. Its lower adapter uses historical resource/provisioning parameter names, but the actual ownership-transfer caller passes owner UUID first and target-device UUID second; the helper and a fixed reverse-order regression preserve that caller contract. The two accepted label values come from IoTivity’s security resource strings.
This is the same derivation path needed after the authenticated manufacturer-certificate channel on the Samsung profiles I have working locally. It stops at deterministic key derivation: obtaining authenticated TLS state remains the caller’s job, while OCF security-resource writes, ownership-transfer policy, persistence, and cloud/account work remain outside this package.
Coverage includes fixed GCM and CCM8 vectors, explicit owner/device ordering, both OXM labels, the complete immutable cipher table, exact type/length validation, nil UUID rejection, secret-safe errors, and an exact public signature contract.
Validation:
This is one commit directly on v0.1.8. It is independent of #42, #43, #36, and #44; those changes can merge in any order.