ntw
ntw
is an experimental firmware for the Nitrokey Pro. It is in very early
development and supports:
- connecting as a USB device with the Nitrokey Pro’s product and vendor ID
- connecting as a HID class device
- using these Nitrokey commands:
GET_STATUS
READ_SLOT_NAME
Usage Example
To be able to compile ntw
, you have to add the thumbv7m-none-eabi target to
your Rust installation, for example by running:
$ rustup target add thumbv7m-none-eabi
Now you can compile ntw
:
$ cargo build --release
To communicate with an MCU connected using an ST-Link debugger, start openocd
using the provided configuration file:
$ openocd --file etc/openocd.cfg
Now you can use gdb
to flash ntw
to the MCU and to start a debugging
session. cargo run
is configured to execute gdb
, flash the MCU and add
breakpoints at the beginning of the program and at the panic handlers. Once
you see the gdb
prompt, type c
to continue the program execution.
$ cargo run --release
Depending on your operating system, you might have to change the name of the
gdb
executable in .cargo/config
.
To verify that everything works as expected, you can try to access the device:
$ nitrocli status
Status:
model: Pro
serial number: 0x00000000
firmware version: 0.1
user retry count: 0
admin retry count: 0
If this does not work, check the output of dmesg
, lsusb
and usbhid-dump
.
Resources
Development Setup
- NUCLEO-F103RB: data sheet
- XNUCLEO-F103RB: Waveshare wiki
- STM32F103RB: data sheet, reference manual
Protocols
- Universal Serial Bus Specification, Revision 1.1
- Universal Serial Bus: Device Class Definition for Human Interface Devices (HID), Firmware Specification, Version 1.11
Minimum Supported Rust Version
This crate requires Rust 1.37.0 or later.
Contact
For bug reports, patches, feature requests or other messages, please send a mail to ntw-dev@ireas.org.
License
This project is licensed under the GNU General Public License version 3
or later. The documentation and configuration files contained in this
repository are licensed under the Creative Commons Zero license. You
can find a copy of the license texts in the LICENSES
directory.
ntw
complies with version 3.0 of the REUSE specification.