Main Content

Let's make a DIY gpg usb key

Some of you may know that you can use yubikey’s as a gpg smart card for message encryption / ssh login however starting at $45 for a compatible one I didn’t really like that, so I searched a bit around and found a project by danman creating such token with a St link V2 (the stm32/8 programmer) after looking a bit I found out that there is the gnuk project that implements just that on a stm32f103.

I, next found that there is another gpg key called the Nitro Key which is cheaper but still a bit pricey. As I already had some Blue pills (stm32f103 devboard) lying around I decided to test it.

I started by finding the source code of gnuk (and the sub module chopstx) which was more difficult than I thought (Some git services were shut down), upon finding the source on GitLab I cloned it on my GitHub (

I named my project TurtleAuth, so I started by just using the same config as the ST_DONGLE target since I don’t plan on changing the MCU and the officials ones are based on the stm32f103c8 (clones are often the stm32f101 which doesn’t officially have “USB capabilities” but can be used anyway somehow). I proceed by creating my own board definition (chopstx/board/turtle-auth.h) and adding / changing configuration like the led pin which I set to PA13 (On board led on the bluepill) and configuring a button on PA8 in pull up”

Link to article