https://github.com/corvus-ch/horcrux
A helper for preparing backups of data worth protecting
https://github.com/corvus-ch/horcrux
backup gpg private-key
Last synced: 5 months ago
JSON representation
A helper for preparing backups of data worth protecting
- Host: GitHub
- URL: https://github.com/corvus-ch/horcrux
- Owner: corvus-ch
- License: mit
- Created: 2018-10-12T19:56:22.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-01-04T17:12:02.000Z (6 months ago)
- Last Synced: 2025-01-04T17:21:12.700Z (6 months ago)
- Topics: backup, gpg, private-key
- Language: Go
- Homepage:
- Size: 302 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Horcrux - a helper for preparing backups of data worth protecting
[](https://travis-ci.org/corvus-ch/horcrux)
[](https://codeclimate.com/github/corvus-ch/horcrux/maintainability)
[](https://codeclimate.com/github/corvus-ch/horcrux/test_coverage)
[](https://packagecloud.io/corvus-ch/tools)
[](https://packagecloud.io/corvus-ch/tools)The use case which brought this tool into existence, is that of creating
backups of GPG private keys or any other cryptographic key or data of similar
value for that matters. Inspired by [paperkey], the idea is to transform the
data into printable form in such a way that easy recovery into its digital
original is possible. Other than [paperkey], this tool allow to split the data
into fragments, which on its own are worthless and only if brought together,
can recreate the secret they were created from.## Install
### deb
curl -s https://packagecloud.io/install/repositories/corvus-ch/tools/script.deb.sh | sudo bash
apt install bilocation### rpm
curl -s https://packagecloud.io/install/repositories/corvus-ch/tools/script.rpm.sh | sudo bash
yum install bilocation### Homebrew
brew install corvus-ch/tools/horcrux
If you are not familiar with Homebrew visit https://brew.sh.
## Usage
Backup a GPG key:
KEY_ID=… # Declare variable holding the ID of the GPG key you want to backup.
gpg --export "${KEY_ID}" > public.gpg
gpg --export-secret-key "${KEY_ID}" > "${KEY_ID}.gpg"
paperkey --secret-key="${KEY_ID}.gpg" --output-type raw --output="${KEY_ID}.bin"
horcrux create "${KEY_ID}.bin"
ls *.txt.* # Those are the files you can now place at your backup locations.Restore a GPG key (builds on top of the above example):
horcrux restore -o paperkey.bin *.txt.* # For this example only two of the three files are required.
paperkey --pubring=public.gpg --secrets=paperkey.bin --input-type=raw --output=secret.gpg
diff "${KEY_ID}.gpg" secret.gpgCreate PDF output using a template
Contents of `text.tmpl` located in the current working directory.
```go-tmpl
{{define "header" -}}
= My document title
{{ printf "%03d" .Output.X }}, {docdate}
:version-label: Fragment
:doctype: book== File Information
[horizontal]
Name:: {{ .Input.Name }}
Size:: {{ .Input.Size }} bytes
MD5:: {{ .Input.Checksums.Md5 }}
SHA1:: {{ .Input.Checksums.Sha1 }}
SHA256:: {{ .Input.Checksums.Sha256 }}
SHA512:: {{ .Input.Checksums.Sha512 }}== Text Data
....
{{end}}{{define "footer" -}}
....== QR Codes
image::{{ .Input.Stem }}.{{ printf "%03d" .Output.X }}.1.png[align="center"]
{{end}}
```horcrux create --encrypt -f text -f qr "/path/to/secret"
for f in test.txt.*; do asciidoctor-pdf -o "${f%.txt.*}-${f##*.}.pdf" "${f}"; donePrint the PDFs. Write the corresponding password onto each of them by hand.
IMPORTANT: This produces an incomplete result, should your secret does not fit in one single QR code.
Add more image lines as needed.## Known issues
The QR code format provide a limited feature set and can not be used to recover
the data directly. A tool like `zbarimg` from the [zbar libary][zbar] can be used to
scan the qr codes so it can be read by the zbase32 format.## Milestones
* [x] Basic application
* [x] Plain text format for print and easy scan/ocr
* [x] QR Code format for easier scanning
* [x] Template system for custom output
* [ ] Extend possibilities with templates## Contributing and license
This library is licenced under [MIT]. For information about how to contribute
to this project, see [CONTRIBUTING.md].[CONTRIBUTING.md]: https://github.com/corvus-ch/horcrux/blob/master/CONTRIBUTING.md
[MIT]: https://github.com/corvus-ch/horcrux/blob/master/LICENSE
[paperkey]: http://www.jabberwocky.com/software/paperkey/
[zbar]: https://zbar.sourceforge.io