Ayush's Personal Blog

Repurposing an Unused Ledger Nano S as a Password Manager

Ledger Nano S connected and displaying its PIN entry screen
A Ledger Nano S ready for use.

I had a spare Ledger Nano S and decided to tinker with it over the weekend. Since I am not involved in cryptocurrency trading, I wanted to repurpose it for another use case. This post explores the Ledger device and its use as a secure, efficient local password manager. I developed a command-line interface (CLI) called gopgvault, which was inspired by the GNU pass utility.

Ledger

Overview

The Ledger Nano S is a cryptocurrency hardware wallet. You can read more about hardware wallets on Ledger Academy. The Nano S has since been discontinued because of increasing memory requirements.

At its core, the Ledger Nano S contains two modules that interact with each other:

All communication with the secure element passes through the STM32, which acts as its proxy.

SDK

Ledger provides an SDK for building applications for its devices. The SDK for the Ledger Nano S is available in the Ledger Secure SDK repository. Make sure you check out the correct branch for your Ledger Nano S firmware. In my case, it was API_LEVEL_LNS.

The host communicates with the Ledger device using APDU messages.

Simple application running on a Ledger Nano S
A simple application running on the Ledger.

However, we do not need to develop an app for PGP encryption because an OpenPGP app already exists. To set up the host to interact with the Ledger OpenPGP app, follow the OpenPGP app instructions.

OpenPGP application displaying a GPG identity on a Ledger Nano S
The OpenPGP application and GPG identity on the Ledger.

A PGP password manager

To supplement the Ledger’s functionality as a GPG card, I developed gopgvault. It is similar to the GNU pass program but has a few differences:


  
Step through gopgvault with the Ledger connected and disconnected.