Skip to main content

Crate zwave_security

Crate zwave_security 

Source
Expand description

§zwave-security

Z-Wave security for host stacks: Security 0 and Security 2.

This crate holds the parts of Z-Wave security that a controller (or a simulated node) runs on the host:

  • s2: Security 2 key derivation (CKDF), the singlecast and multicast nonce state (SPAN and MPAN) on top of drbg::CtrDrbg, and the Message Encapsulation format with its extensions, all per the Z-Wave Alliance’s Security 2 specification.
  • s0: Security 0 nonces and Message Encapsulation (AES-OFB with a CBC-MAC).
  • kex: the key exchange constants and the Curve25519 key pair.
  • dsk: Device Specific Keys, PINs and the SmartStart home ids derived from them.
  • qr and provisioning: SmartStart QR codes and the provisioning list a controller keeps.

The block cipher, CMAC, CCM, OFB, CBC-MAC and X25519 come from maintained crates (RustCrypto, dalek). The only construction written here is the AES-128 CTR_DRBG without a derivation function that S2 nonces need, checked against NIST’s CAVP vectors.

Part of zwave-bridge, maintained by Pulzar. See the user guide, the library guide and the API documentation.

License: MIT.

Modules§

ckdf
S2 key derivation (CKDF), per the Security 2 specification.
crypto
Thin wrappers over the RustCrypto primitives in the shapes Z-Wave uses.
drbg
AES-128 CTR_DRBG without a derivation function (NIST SP 800-90A Rev. 1, section 10.2.1), the generator S2 uses for SPAN nonces.
dsk
Device Specific Keys: the first 16 bytes of a node’s public key.
kex
S2 key exchange (KEX) constants and the Curve25519 key pair.
provisioning
The SmartStart provisioning list a controller keeps.
qr
SmartStart and S2 QR codes (the Z-Wave Alliance’s Node Provisioning QR code format): all decimal digits, 90, a version, a SHA-1 checksum, the requested keys, the DSK and then TLV blocks.
s0
Security 0: nonces and Message Encapsulation.
s2
Security 2: Message Encapsulation, extensions, and the SPAN and MPAN nonce state.

Enums§

Error
Errors from this crate.
SecurityClass
A Z-Wave security class, the unit in which network keys are granted.

Functions§

random_bytes
Returns N random bytes from the operating system’s CSPRNG.
random_fill
Fills buf from the operating system’s CSPRNG.

Type Aliases§

NetworkKey
A 128-bit network key.