Split hybrid public keys into separate wire fields

The packed 1216-byte hybrid public had no consumer that wanted it
whole -- everything unpacked immediately. Message layouts and the
credential record now carry peer_m | peer_x as explicit fields; _PUB
and the unpack-at-use idiom are gone. credential_id values change with
the record layout. Step comments in the exchange methods explain what
each solve/challenge proves.
This commit is contained in:
LeoVasanko committed 2026-10-07 17:59:13 +00:00
1 parent 168287ca98
commit f035859fd2
5 files changed
+92 -73

No files matched your search

+5 -3
View File
@@ -38,7 +38,7 @@ def _describe(obj) -> str:
# given to both parties out of band and stored as a bare 32-byte store
# entry. The first successful registration replaces it with the composite.
_CREDENTIAL = struct.Struct("32s32s1216s4s?") # idroot | shared | peer pub | sas | vf
_CREDENTIAL = struct.Struct("32s32s1184s32s4s?") # idroot|shared|peer_m|peer_x|sas|vf
def generate_registration_secret() -> bytes:
@@ -240,10 +240,12 @@ class Session:
(
self._idroot,
self._shared,
self._peer_pub,
peer_m,
peer_x,
self._sas,
self._credential_verified,
) = _CREDENTIAL.unpack(cred)
self._peer_pub = (peer_m, peer_x)
self._registering = False
hs = Resumption(self._shared, self._idroot, self._peer_pub, self._ad)
self._exchange = hs
@@ -263,7 +265,7 @@ class Session:
# persists the store itself if it wants durability
self._credential_verified = verified
self._stored = _CREDENTIAL.pack(
self._idroot, self._shared, self._peer_pub, self._sas, verified
self._idroot, self._shared, *self._peer_pub, self._sas, verified
)
self._store[self._key_id] = self._stored