Sig-Net Protocol Framework
sĭg nĕt
Sig-Net is a secure, multicast-based protocol for DMX512 entertainment lighting control built on CoAP (RFC 7252). It provides authenticated packet delivery via HMAC-SHA256, key derivation via HKDF, and anti-replay protection — all in a lightweight UDP multicast package.
This is a pure Rust implementation of the Sig-Net Protocol Framework specification, ported from the original C++ SDK with zero unsafe code.
Repository Packages
| Package | crates.io | Docs | Description |
|---|---|---|---|
sig-net (this crate) |
Core library — types, crypto, CoAP, TLV, parsing, UDP | ||
signet-ffi |
— | — | C-compatible FFI bindings (staticlib + cdylib + cbindgen header) |
Quick Start
[]
= "0.5"
Build and send a DMX level packet:
use *;
let mut k0 = ;
derive_k0_from_passphrase?;
let mut sender_key = ;
derive_sender_key?;
let tuid = TUIDfrom_hex?;
let dmx: = .map.collect;
let mut buf = new;
build_dmx_packet?;
Feature Flags
[]
= { = "0.5", = false } # core types (zero deps)
= { = "0.5", = ["crypto"] } # + HMAC/HKDF/PBKDF2/passphrase
= { = "0.5", = ["crypto", "net"] } # + UDP multicast (default)
API Overview
Core Types
let header = new;
let mut buf = new;
let tuid = TUIDfrom_hex?;
let addr = calculate_multicast_address?;
Cryptography (sig_net::crypto)
hmac_sha256?;
hkdf_expand?;
derive_k0_from_passphrase?;
derive_sender_key?;
validate_passphrase?;
verify_packet_hmac?;
Protocol Building
build_coap_header?;
encode_tid_level?;
build_dmx_packet?;
build_announce_packet?;
build_poll_packet?;
Protocol Parsing
let mut reader = new;
let header = reader.parse_coap_header?;
let options = reader.parse_signet_options?;
let tlv = reader.parse_tlv_block?;
let slots = parse_tid_level?;
UDP Multicast
let socket = bind?;
socket.join_multicast_group?;
socket.send_multicast?;
let = socket.recv_from?;
C / C++ FFI
See signet-ffi.
uint8_t k0;
;
uint8_t sender_key;
;
Examples
| Example | Location | Run |
|---|---|---|
| Core types | examples/rust/core.rs |
cargo run -p sig-net --example core |
| Cryptography | examples/rust/crypto.rs |
cargo run -p sig-net --example crypto |
| Full protocol | examples/rust/full.rs |
cargo run -p sig-net --example full |
| C++ FFI demo | examples/signet-ffi/ffi-demo.cpp |
make -C examples/signet-ffi run |
Test Vectors
| Test | Status | Details |
|---|---|---|
| RFC 4231 TC1 | ✅ | Key=20×0x0B, Data="Hi There", HMAC=B0344C61... |
| RFC 4231 TC2 | ✅ | Key="Jefe", Data="what do ya want...", HMAC=5BDCC146... |
| PBKDF2 K0 | ✅ | 100k iterations, "Ge2p$E$4*A" → K0=52FCC2E7... |
Crate Structure
crates/
├── sig-net/ ← main library
│ ├── src/
│ │ ├── constants protocol constants (TIDs, option numbers, crypto params)
│ │ ├── types CoAPHeader, PacketBuffer, TUID, SigNetOptions
│ │ ├── crypto HMAC-SHA256, HKDF, PBKDF2, key derivation, passphrase
│ │ ├── coap CoAP header/option encoding, URI building
│ │ ├── tlv TLV payload encoding
│ │ ├── security SigNet custom options, HMAC input/output
│ │ ├── send DMX packet, announce, poll packet builders
│ │ ├── parse PacketReader, CoAP/TLV parsing, HMAC verification
│ │ └── net UDP multicast (socket2)
│ └── tests/
│ └── integration.rs 24 integration tests
└── signet-ffi/ ← C-compatible FFI (see [README](../signet-ffi/README.md))
examples/
├── rust/ ← Rust examples (core, crypto, full)
└── signet-ffi/ ← C++ FFI demo (ffi-demo.cpp + Makefile)
Safety
Zero unsafe blocks in the entire sig-net library:
- CoAP header uses manual bit-shifting instead of
#[repr(packed)] - Network I/O uses the
socket2crate (safe abstraction over Winsock/BSD sockets) - Constant-time HMAC comparison uses the
subtlecrate
License
Sig-Net is free and open-source software licensed under the MIT License.