This simple program will help you run Shamir's Secret Sharing algorithm on any file using the split
and merge
commands. It also contains tools to easily generate
an AES key and encrypt
and decrypt
files using said key.
There is a bitcoin bounty ready to be claimed if you can bypass this scheme.
If you are backing up a bitcoin wallet, you might be better off doing something with multisig. This article summarizes some of the drawbacks of Shamir, but I think in some cases it's still a good solution!
This is not security-hardened code. Use at your own risk.
# Generate a new AES Key
shush generate my.key
# Encrypt a secret file or archive with your AES Key
shush encrypt -key=my.key secrets.tar
# Decrypt a payload using an AES key
shush decrypt -key=my.key secrets.tar.shush
# Split a file into 5 shards, requiring a threshold of at least 3 shards for recovery
shush split -t=3 -s=5 my.key
# Merge shards back into the original file
shush merge my.key.shard0 my.key.shard2 my.key.shard4
# On unix you can also use a wildcard, if the names are preserved.
shush merge my.key.shard*
# On a unix-based system with go installed...
go build -o shush main.go
# install on your system
mv shush /usr/local/bin
If you've distributed the shards of an AES key to your team (read: family, friends, coworkers), they will be able to recover any encrypted data in case you lose it, become incapacitated, or worse.
With Shamir's algorithm, you can specify a threshold
for recovery that is lower than the total number of shards
. This approach protects you against some members of your team losing their shards.
Run this program in Tails with no internet connection. Be extremely careful about how you store your key! Distribute shards to your team on physical media (like flash drives). You may also want to notify your team members who else is on their team, but ideally that information will live in their heads, not in their emails.
You may want to consider including any of the following things when distributing shards:
Since the payload likely has sensitive contents, you should take similar precautions (tails, offline, etc.) when re-assembling keys and decrypting payloads.
If you hold onto your original AES key, you can create new encrypted payloads whenever you want, and redistribute or upload just the payload without having to generate new keys or distribute new shards.
Nothing. Choose your team wisely.