Expand description
High-level crypto service exposed to the USB layer.
This is where the actual workflow logic lives: PIN session management,
PIN/PUK verification with counter accounting, sign orchestration on top
of Nonce + Sign, and public-key retrieval.
The service is generic over both the HAL (so it can run against a real
ATECC over I2C or against a MockHal in tests) and the Clock (so
tests can drive time deterministically).
§Channel discipline
Every public method on CryptoService is responsible for opening
and closing the chip channel(s) it needs.
- For a single-shot chip command (e.g. read one counter), the method opens a channel, runs the command, closes the channel.
- For a multi-step chip workflow that shares volatile state
(Nonce + Sign, Nonce +
GenDig+ Write), the method opens one channel that spans the whole sequence, soTempKeystays alive across the steps. - For workflows that combine several independent chip commands
(e.g. read counter, then
CheckMac, then read counter again), the method may either keep one channel open for the whole flow or open one per command. The choice is documented per method when it matters; the default is to open one per logical step for clarity.
The PIN “session” referred to elsewhere in this crate is unrelated to
the chip channel. It is the host-side authentication window that
says “the user has typed a valid PIN recently”. See Session.
Structs§
- Crypto
Service - High-level crypto orchestrator.
- Device
Info - Returned by
CryptoService::info. - PinStatus
- Returned by
CryptoService::get_pin_status.
Constants§
- CHIP_
SERIAL_ 🔒LEN - Length of the chip serial number, in bytes, as read from the config zone.
Functions§
- can_
write_ 🔒block_ in_ one_ transfer - Whether the chip accepts a single 32-byte
Writefor the whole block. - retries_
remaining 🔒 - Compute how many
CheckMacattempts remain before the next batch threshold is hit. - writable_
words_ 🔒in_ block - Set of word offsets (within a 32-byte config-zone block) that the chip’s
Writecommand accepts in 4-byte mode.
Type Aliases§
- Public
Key 🔒 - 64-byte raw public key returned by
GenKey. - Service
Result 🔒 - Convenience alias for the service’s result type.
- Signature 🔒
- 64-byte raw
R || SECDSA signature returned bySign.