Something went wrong. Try again.
ACME Service and Go API for PicoHSM
Something went wrong. Try again.
Files
- Go 100%
README.md
# picohsm: Go Client & Tooling for Raspberry Pi Pico HSM
`picohsm` is a pure-Go library and administrative CLI for interacting with the [Raspberry Pi Pico HSM](https://github.com/polhenarejos/pico-hsm) (RP2040 and RP2350) running the SmartCard-HSM applet.
It communicates directly with the USB device via Linux USBFS (`ioctl`) using standard ISO 7816-4 and USB CCID protocols, eliminating the need for `pcscd`, OpenSC, or external C/C++ dependencies.
## Features
- **Pure Go & Minimal Dependencies**: Zero CGO, zero external Go runtime dependencies. Relies strictly on the standard library.
- **Direct USBFS CCID Transport**: Direct device communication via Linux `/dev/bus/usb/` with automatic device discovery (`2e8a:10fd`).
- **Standard `crypto.Signer` Integration**: Seamlessly integrates with Go's `crypto/x509` and `crypto/tls` packages to issue certificates and establish mutual TLS across both modern Elliptic Curve (ECDSA P-256/P-384) and legacy RSA (PKCS#1 v1.5 with SHA-1, SHA-256, etc.).
- **Legacy CA Migration & Offline Wrapping (`wrap-key`)**: Securely wrap existing RSA private keys offline on air-gapped laptops under DKEK without needing an attached HSM, and import them seamlessly onto target Pico HSMs.
- **Hardware Key Backup & Replication (DKEK)**: Full support for Device Key Encryption Key (DKEK) share generation, import, key wrapping (`INS 0x72`), and key unwrapping (`INS 0x74`) with automatic large-payload staging (`0x2F10`) to enable hot standby, cold disaster recovery, and multi-HSM load balancing.
- **Administrative CLI (`pico-hsm-tool`)**: Comprehensive management of PINs, dynamic hardware options, EC keypair generation, DKEK lifecycle, CSR signing (`sign-csr`), and certificate issuance.
---
## Installation & Setup
### Prerequisites
- Go 1.22 or newer
- Linux host or container with access to `/dev/bus/usb/`
- Raspberry Pi Pico (RP2040 or RP2350) flashed with [`pico-hsm`](https://github.com/polhenarejos/pico-hsm) firmware (USB ID `2e8a:10fd`)
### Build from Source
```bash
git clone https://go.is…