spec: align encrypted timestamp units with CSA NHP standard
Author: justin-layervCreated Jun 12, 2026Updated Jun 12, 2026
LabelsbugcompatibilityP1
Summary
The CSA NHP standard describes the encrypted timestamp field as an 8-byte UNIX timestamp in milliseconds since epoch plus a 16-byte AEAD tag.
Current OpenNHP main serializes nanoseconds:
nhp/core/initiator.go:mad.LocalInitTime = time.Now().UnixNano().nhp/core/initiator.go:binary.BigEndian.PutUint64(tsBytes[:], uint64(mad.LocalInitTime))writes that nanosecond value into the encrypted timestamp field.- Receiver-side replay/staleness logic also operates on nanosecond values.
Why This Matters
OpenNHP peers agree with each other today, but a strict CSA-standard peer using millisecond timestamps will not interoperate correctly. Because the timestamp feeds freshness/replay checks, unit drift is security-sensitive and should be explicit.
Suggested Acceptance Criteria
- Decide whether the wire timestamp should be milliseconds per CSA standard.
- If yes, add versioned/backward-compatible handling for existing nanosecond-format peers.
- Add encoding KATs for timestamp units.
- Add replay/staleness tests covering standard-compatible packets and any compatibility mode.
Source: OpenNHP/opennhp