Skip to main content

verify_hello

Function verify_hello 

Source
pub fn verify_hello(
    hello: &PeerHello,
    from: HandshakeRole,
    exporter: &[u8; 32],
    local_device: Uuid,
    trust: &PinnedTrust,
    versions: &dyn DirectoryVersions,
) -> Result<(Uuid, String), PeeringError>
Expand description

The application-layer hybrid check — the whole security of the channel. Run before any payload byte against the locally-pinned trust. In order:

  1. Version window. The pair speaks the highest common version; disjoint windows abort with PeeringError::VersionDisjoint before any identity check.
  2. Directory chains to our IK. The pinned directory must verify under our pinned User IK; a directory signed by a foreign IK is rejected outright.
  3. Anti-rollback. The pinned directory must not be older than the highest this device has verified, and the peer must not present a version older than the one we pin.
  4. Not ourselves. A hello claiming local_device, our own id, is refused with PeeringError::SelfPeer: a device never peers with itself.
  5. Enrolled + not revoked. The claimed device_id must be present and un-revoked.
  6. Hybrid proof. The peer’s published device key must verify the hybrid signature over the exact exporter material we derived, bound to from: the role the peer holds on this channel, the opposite of ours. That binds the hybrid identity to this TLS session and to its far end, so a hello reflected back at its sender fails.

Returns the verified device id and the negotiated protocol version.