feat(server): add V3 HMAC framing - #821
Conversation
8a52acd to
656d3e0
Compare
Co-Authored-By: Codex <noreply@openai.com>
|
@bvanelli Could you review the V3 framing boundary here, particularly the HMAC input, response IntegrityId placement, and the emulator's explicit session-key setup? This is emulator-focused, so I am looking for a protocol review rather than another PLC capture. The refreshed head is based on current |
|
|
||
| def test_v3_hmac_verification(self) -> None: | ||
| application_data = b"S7CommPlus request" | ||
| digest = hmac.new(TEST_SESSION_KEY, application_data, hashlib.sha256).digest() |
There was a problem hiding this comment.
I know it's not relevant, and it is personal preference, but this test reinforces what _verify_v3_hmac already does. For a real immutable test I would take a Wikipedia example, because it is verifiable.
There was a problem hiding this comment.
Good point about making fixtures independently inspectable. This test does use Python stdlib hmac.new to produce the expected digest, so it is not only comparing our two verifier implementations to each other. I will keep the existing fixture in this focused PR; a published fixed vector would still be a useful follow-up if we expand the low-level HMAC tests.
Summary
The emulator accepts an explicit 24-byte-or-longer
session_key. It cannot derive the client random key from material encrypted for a real Siemens PLC without the corresponding private key, so this gives tests and emulator users matching negotiated key material.Dependency
#775 has merged. This branch now includes current
mastervia a merge commit and targetsmasterdirectly.Validation
uv run --frozen pre-commit run --all-filesuv run --frozen pytest -q(1824 passed, 78 skipped)uv build --no-sourcesFixes #803