hardcopy 1.0.1

Generate hard copies of keys, certs and secrets.
Documentation

hardcopy

Current Release: 1.0.1

License: GPL v3 builds.sr.ht status Latest version Documentation

CLI tool for generating printable hard copies (PDF, HTML, TXT) of binary data: PGP keys, certificates, seeds, and other secrets.

Installation

cargo install hardcopy

Usage

# From stdin
cat private.key | hardcopy -o backup.pdf

# From file
hardcopy -i private.key -o backup.pdf

# Disable QR codes (text only)
hardcopy -i private.key --no-qrcode -o backup.txt

# Custom title and description
hardcopy -i private.key --title "My PGP Key" --description desc.txt -o backup.pdf

# HTML output with custom template
hardcopy -i private.key --template template.html -o backup.html

Output Formats

Extension Format Notes
.pdf PDF Requires monospace font directory (--font-dir)
.txt Plain text Line-numbered word lists
.html HTML Uses template from --template

Output Sections (enabled by default)

Flag Section Description
(default) PGPfone Phonetic word list, 4 words/line
(default) S/KEY OTP 6-word lines with 2-bit checksum
(default) QR Code PNG images, chunked at 500 bytes
--no-bip39 BIP-39 2048-word mnemonic, 6 words/line
--no-diceware Diceware EFF Large wordlist, 12 bits/word

Disable any section with --no-<section> (e.g., --no-qrcode, --no-pgpfone).

Example: PGP Key Backup

# Export keys
gpg --output public.pgp  --armor --export user@example.com
gpg --output private.pgp --armor --export-secret-key user@example.com

# Generate PDF backup with all sections
cat public.pgp private.pgp | hardcopy -o pgp-backup.pdf

# Minimal backup (text only, no QR)
cat public.pgp private.pgp | hardcopy --no-qrcode -o pgp-backup-min.txt

Verification

Each output includes a SHA-256 checksum footer. Verify with softcopy:

softcopy --verify recovered.txt
# Enter checksum from hard copy when prompted

Options

hardcopy [OPTIONS] <OUTPUT_FILE>

OPTIONS:
    -i, --input <FILE>        Input file (default: stdin)
    --no-pgpfone              Disable PGPfone word list
    --no-skeyotp              Disable S/KEY OTP word list
    --no-qrcode               Disable QR code generation
    --no-bip39                Disable BIP-39 word list
    --no-diceware             Disable Diceware word list
    --font-dir <DIR>          Font directory for PDF output
    --font-name <NAME>        Font family name for PDF output
    --template <FILE>         HTML template file
    --debug                   Enable debug logging

Features

Default features: out-pgpfone, out-skeyotp, out-qrcode, out-bip39, out-diceware

[dependencies]
hardcopy = { version = "1.0.0", features = ["out-qrcode", "out-bip39"] }

Recovery

Use softcopy (sibling project) to recover data from hard copies:

# Interactive decode from PGPfone word list
softcopy --from plugins.pgpfone -o recovered.key

# Verify checksum
softcopy --verify recovered.key