diff --git a/website/versioned_docs/version-fils_en/project/2026/paul.draghici/ComponentDiagram.webp b/website/versioned_docs/version-fils_en/project/2026/paul.draghici/ComponentDiagram.webp new file mode 100644 index 00000000000..95a4add11dd Binary files /dev/null and b/website/versioned_docs/version-fils_en/project/2026/paul.draghici/ComponentDiagram.webp differ diff --git a/website/versioned_docs/version-fils_en/project/2026/paul.draghici/index.md b/website/versioned_docs/version-fils_en/project/2026/paul.draghici/index.md index f7803d63807..023d3b6cf00 100644 --- a/website/versioned_docs/version-fils_en/project/2026/paul.draghici/index.md +++ b/website/versioned_docs/version-fils_en/project/2026/paul.draghici/index.md @@ -9,72 +9,51 @@ A secure password manager that stores credentials on-chip and acts as a physical ## Description -My project aims to build a hardware-based password manager using the STM32U545RE microcontroller. The device securely stores user credentials in its internal non-volatile memory. Through a physical rotary encoder and an OLED interface, the user can unlock the vault using a Master PIN and select a specific account. Then, the STM32 will decrypt the associated password and will act as a standard Human Interface Device (HID) keyboard, injecting the keystrokes directly into the host computer. +My project aims to build a hardware-based password manager using the STM32U545RE microcontroller. The device securely stores user credentials in its volatile memory (storing passwords and remembering user sessions will be implemented later as an upgrade). + +Through a physical rotary encoder and a 2.2" 240x320 SPI display interface, the user can unlock the vault using a Master PIN and select a specific account. Then, the STM32 will retrieve the associated password and will act as a standard Human Interface Device (HID) keyboard, injecting the keystrokes directly into the host computer. ## Motivation -The goal is to design a highly secure credential vault that mitigates software-based keylogging and clipboard snooping. I wanted to build something with a strict security architecture. By utilizing the STM32's Internal Flash Memory rather than external storage (like an SD card or EEPROM), the device leverages Hardware Readout Protection (RDP) to physically lock the silicon against external debugging and data extraction. This prevents physical theft and I2C/SPI bus sniffing. +Firstly, I thought this idea is something very useful on a daily basis. The goal is to design a highly secure credential vault that mitigates software-based keylogging and eliminates dependence on external software for password autocompletion. By acting as an isolated external hardware device, the host PC never has direct access to the raw password database. This physical separation ensures that sensitive passwords never touch the host system's vulnerable clipboard. ## Architecture -The system architecture centers around the STM32U545RE, which coordinates user input, visual feedback, cryptography, and USB communication. - -The user interacts with the device via the KY-040 Rotary Encoder, scrolling through a text-based menu displayed on the SSD1306 OLED screen (connected via the I2C bus). Because the STM32's built-in USB port is strictly linked to the ST-LINK programmer, a dedicated USB Type-C breakout board is going to be used. Once the user selects an account and inputs their Master PIN, the STM32 derives a 256-bit AES key, decrypts the payload stored in the dedicated Internal Flash sector, and formats it as HID reports sent to the PC over the Type-C connection. Resistors are used on the breadboard to ensure I2C signal integrity. - -#### Component connections -``` - -[INTERFACE & OUTPUT SECTION] [CONTROL & STORAGE SECTION] - -+-------------------------+ +----------------------------+ -| HOST PC | | HOST PC | -| (Receives Keystrokes) | | (Power & Flash/Debug) | -+-----------+-------------+ +-------------+--------------+ - ^ ^ - [USB Data Cable] [USB] - | | - v v -+-----------+-------------+ +----------------------------+ -| USB Type-C Breakout | | NUCLEO STM32U545RE-Q | -| (Custom HID Keyboard) | | (Main Microcontroller) | -+-----------+-------------+ +---+--------+--------+------+ - | | | | - | [D+ and D- Data Pins] | [I2C] [GPIO] - | | (Bus) (Interrupts) - +------------------------------>| | | - | v v - | +-------+ +----------+ - | |SSD1306| | KY-040 | - | | OLED | | Encoder | - | +-------+ +----------+ - | ^ ^ - | | | - | [3.3V Logic Power] - | (From Nucleo pins) - | | | - +--------+---------+ - | - v - +----------+----------+ -[Common Ground] <----------------| INTERNAL FLASH | - | (Encrypted Storage) | - +---------------------+ -``` +The system architecture centers around the STM32U545RE microcontroller, which orchestrates user input, visual feedback, cryptographic operations, and USB communication. The user interacts with the device via a KY-040 Rotary Encoder, navigating a text-based interface rendered on the ILI9341 SPI display. + +Because the development board's onboard USB port is hardwired to the ST-LINK programmer, a dedicated USB Type-C breakout board is used to establish a direct data connection to the host PC. +Upon selecting an account, the STM32 retrieves the decrypted payload from volatile memory and formats it as standard Human Interface Device (HID) keyboard reports, injecting the keystrokes over the Type-C connection. + +Finally, to satisfy strict USB enumeration timing constraints, the USB peripheral is deliberately initialized only after the system completes its primary boot sequence and renders the initial UI. + +## Component connections + +![Component Diagram](./ComponentDiagram.webp) + ## Log ### Week 3-4 -I have defined the hardware architecture and ordered all the necessary components. Finalized the decision to use internal Flash memory rather than an external SD card to maximize hardware-level security and prevent bus-sniffing. +I have defined the hardware architecture and ordered all the necessary components. ### Week 5-7 -I studied the technical documentation and datasheets for the SSD1306 OLED (I2C) and the KY-040 rotary encoder to prepare the necessary firmware communication protocols and hardware timer configurations. I also researched the STM32's USB 2.0 Full Speed capabilities and finalized the full bill of materials before ordering all necessary hardware components and prototyping materials. +I studied the technical documentation and datasheets for the ILI9341 LCD and the KY-040 rotary encoder to prepare the necessary firmware communication protocols and SPI peripheral configurations. I also researched the STM32's USB 2.0 Full Speed capabilities. Decided to go with the SPI screen because testing revealed the former I2C screen to be faulty, and because it offered better functionality. ### Week 8-9 -I began the hardware assembly phase by soldering the necessary header pins to the USB Type-C breakout board. I set up the initial breadboard prototype, establishing the first communication links between the OLED and the STM32 via I2C (using resistors for signal integrity), while testing the initial USB HID enumeration to ensure the host PC correctly recognized the microcontroller as a standard keyboard. +I began the hardware assembly phase by soldering the necessary header pins to the USB Type-C breakout board. I set up the initial breadboard prototype, establishing the first communication links between the ILI9341 screen and the STM32 via SPI, while testing the initial USB HID enumeration to ensure the host PC correctly recognized the microcontroller as a standard keyboard. +I also researched methods for character injection. + +![Component Diagram](./photo_of_hardware.webp) + +### Week 9-12 +Modularizing the code, creating separate files display.rs and serial.rs. Created display states, built the underlying logic. Handled graphics rendering using embedded-graphics (PIN entry screen and the scrollable selection menu), and implemented the asynchronous executor in order for the USB peripheral to poll in the background. Input interpretation: Developed the logic for the KY-040 rotary encoder. + +### Week 13-14 +Final code testing phase, bug fixing, and improving efficiency (choosing to refresh only the UI element that is modified, not the entire screen, for example). Finalized the USB transmission to ensure flawless HID keystroke injection from the STM to the host PC. # Hardware -The central part of the system is the STM32U545RE microcontroller, utilizing its internal Flash memory for secure data storage. +The central component of the system is the STM32U545RE microcontroller, which currently utilizes its internal volatile memory (RAM) to securely manage credentials during an active session. This stateless approach ensures that no sensitive data persists after power is removed. -The user interface consists of the KY-040 Rotary Encoder (for navigation and selection via its push-button) and a 0.96" SSD1306 OLED Display for visual feedback. A USB Type-C Breakout Board is required to physically bridge the STM32's data pins to the host PC, bypassing the onboard ST-LINK. Standard prototyping materials (breadboard, Dupont wires, and resistors) are used to combat "floating pins" and stabilize the I2C communication. +The user interface consists of a KY-040 Rotary Encoder—providing tactile navigation and selection via its integrated push-button—paired with an ILI9341 SPI TFT screen for clear visual feedback. To bridge the hardware to the host PC, a USB Type-C Breakout Board is used to route the STM32's native USB data pins, allowing the device to act as a standalone standard keyboard (HID). ### Bill of Materials @@ -82,12 +61,12 @@ The user interface consists of the KY-040 Rotary Encoder (for navigation and sel |--------|--------|-------| | [STM32 Nucleo-U545RE](https://www.st.com/en/evaluation-tools/nucleo-u545re-q.html) | The main microcontroller acting as the vault brain | 120 RON | | [KY-040 Rotary Encoder](https://sigmanortec.ro/Encoder-rotativ-KY-040-p126258216) | User input interface (navigation and tactile button) | 6.50 RON | -| [0.96" SSD1306 OLED (I2C)](https://sigmanortec.ro/Display-OLED-0-96-I2C-IIC-Albastru-p135055705) | Display interface for the text-based menu | 12.99 RON | -| [USB Type-C Breakout (Data)](https://sigmanortec.ro/modul-type-c-la-pini-de-panou-tensiune-si-date-usb-31) | Host connectivity to establish a direct HID connection | 4.99 RON | +| [LCD SPI 2.2'' 240x320 px](https://www.optimusdigital.ro/ro/optoelectronice-lcd-uri/1260-lcd-spi-22-240x320-px.html?search_query=spi&results=223) | Display interface | 59.99 RON | +| [USB Type-C Data Module](https://sigmanortec.ro/modul-type-c-la-pini-de-panou-tensiune-si-date-usb-31) | Host connectivity to establish a direct HID connection | 11.53 RON | | [Breadboard 400 points](https://sigmanortec.ro/Breadboard-400-puncte-p125633800) | Prototyping hub and resistor mounting | 5.00 RON | | [40 Dupont Wires Female-Female](https://sigmanortec.ro/40-fire-Dupont-10cm-Mama-Mama-p129872525) | Direct board-to-module connections | 4.50 RON | | [40 Dupont Wires Male-Male](https://sigmanortec.ro/40-fire-Dupont-10cm-Tata-Tata-p129872516) | Breadboard connections | 4.50 RON | -| [4.7kΩ Resistors (20x)](https://sigmanortec.ro/Rezistor-p126025265) | Hardware pull-ups for I2C and signal integrity | 3.20 RON | +| [4.7kΩ Resistors (20x)](https://sigmanortec.ro/Rezistor-p126025265) | Hardware pull-ups for the encoder and signal integrity | 3.20 RON | ## Schematics @@ -100,12 +79,17 @@ The user interface consists of the KY-040 Rotary Encoder (for navigation and sel | [embassy-stm32](https://github.com/embassy-rs/embassy) | Async embedded framework | Initializing communication and connecting peripherals | | [embassy-executor](https://github.com/embassy-rs/embassy) | Async/await executor | Spawning the main hardware tasks | | [embassy-usb](https://github.com/embassy-rs/embassy) | USB protocol stack | Establishing the USB 2.0 Full Speed connection | +| [embassy-sync](https://github.com/embassy-rs/embassy) | Async synchronization | Providing thread-safe channels to pass payloads between the UI and USB tasks | | [usbd-hid](https://github.com/rust-embedded-community/usb-device) | USB HID class definitions | Transmitting decrypted keystrokes to the host PC | -| [ssd1306](https://github.com/jamwaffles/ssd1306) | Display driver | Initializing the I2C OLED screen | | [embedded-graphics](https://github.com/embedded-graphics/embedded-graphics) | 2D graphics library | Drawing the text-based menu UI | -| [aes-gcm](https://github.com/RustCrypto/AEADs) | Cryptography library | Encrypting and decrypting password payloads | -| [pbkdf2](https://github.com/RustCrypto/password-hashes) | Key derivation function | Deriving a secure 256-bit AES key from the user's PIN | -| [embedded-storage](https://github.com/rust-embedded/embedded-hal) | Storage abstraction | Managing non-volatile memory in the STM32's Internal Flash | +| [embedded-hal-bus](https://github.com/rust-embedded/embedded-hal) | Shared bus abstractions | Providing the ExclusiveDevice wrapper to safely manage the SPI Chip Select pin | +| [ili9341](https://github.com/sharebrained/rust-lcd-ili9341) | Display driver | Initializing the specific 240x320 LCD screen and managing orientation | +| [display-interface-spi](https://github.com/therealprof/display-interface) | Display communication | Abstracting the SPI bus and Data/Command pin for the ILI9341 driver | +| [heapless](https://github.com/rust-embedded/heapless) | No-std data structures | Providing memory-safe, fixed-capacity dynamic arrays (Vec, String) without allocators | +| [defmt](https://github.com/knurling-rs/defmt) | Deferred formatting | Generating highly efficient, compressed debug logs | +| [defmt-rtt](https://github.com/akiles-dev/defmt-rtt-target) | RTT transport for defmt | Transmitting the compressed logs to the host PC via Real-Time Transfer | +| [panic-probe](https://github.com/knurling-rs/probe-run) | Panic handler | Catching fatal errors and routing the stack trace through the debug interface | + ## Links diff --git a/website/versioned_docs/version-fils_en/project/2026/paul.draghici/kicadproject.svg b/website/versioned_docs/version-fils_en/project/2026/paul.draghici/kicadproject.svg index f6e694e1ecd..425f33e75c9 100644 --- a/website/versioned_docs/version-fils_en/project/2026/paul.draghici/kicadproject.svg +++ b/website/versioned_docs/version-fils_en/project/2026/paul.draghici/kicadproject.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/website/versioned_docs/version-fils_en/project/2026/paul.draghici/photo_of_hardware.webp b/website/versioned_docs/version-fils_en/project/2026/paul.draghici/photo_of_hardware.webp new file mode 100644 index 00000000000..6103c00bbd3 Binary files /dev/null and b/website/versioned_docs/version-fils_en/project/2026/paul.draghici/photo_of_hardware.webp differ