Skip to content

Instantly share code, notes, and snippets.

@Saltinbank-SyS
Forked from jondb/readme.md
Created June 29, 2022 23:46
Show Gist options
  • Save Saltinbank-SyS/0b69376c4b415a3d9f3d34b1ad68b2ed to your computer and use it in GitHub Desktop.
Save Saltinbank-SyS/0b69376c4b415a3d9f3d34b1ad68b2ed to your computer and use it in GitHub Desktop.
Using SSSS

Install

launch a new ubuntu image

Docker

docker run -i -t ubuntu /bin/bash
apt-get update
apt-get install ssss

Digital ocean

apt-get update
apt-get install ssss
apt-get install haveged  # This is to make /dev/random work

Generate secret

secret_base64=$(python -c "import os;print os.urandom(32).encode('base64').replace('\n','')")
echo Your new secret is: $secret_base64

Shard secret

echo $secret_base64 | ssss-split -t 2 -n 5
unset secret_base64

Example

root@ssss:~# secret_base64=$(python -c "import os;print os.urandom(32).encode('base64').replace('\n','')")
root@ssss:~# echo Your new secret is: $secret_base64
Your new secret is: ic1SnTZhMCQ13BkfSqaxVeqoSeu3uLUsMgo348iRm7w=
root@ssss:~# echo $secret_base64 | ssss-split -t 2 -n 5
Generating shares using a (2,5) scheme with dynamic security level.
Enter the secret, at most 128 ASCII characters: Using a 352 bit security level.
1-16fadadcc7c7e71700bd301b9ea73c6cd09d7cef4193021a1cb36c59f6ae917ee1ee4e855c39c0aaf4139de6
2-7f724732b36399da8b2a8cebfaa6a0abb8758435658b095ec97a1079ff3e4201ddd9b2720f5f71a8b99776d9
3-580a339760ffb39e0da7e74426a62b169fd22c7c867cf06285c2c46607b1f32b3634e620c182e15682eb2fce
4-ac637cee5a2b64419c05f50b32a5992569a475812dbb1fd762e8e839ec1fe4ffa5b64b9ca99213ac229ea0b9
5-8b1b084b89b74e051a889ea4eea512984e03ddc8ce4ce6eb2e503c26149055d54e5b1fce674f835219e2f9ae
root@ssss:~# # Decrypt
root@ssss:~# ssss-combine -t 2
Enter 2 shares separated by newlines:
Share [1/2]: 3-580a339760ffb39e0da7e74426a62b169fd22c7c867cf06285c2c46607b1f32b3634e620c182e15682eb2fce
Share [2/2]: 5-8b1b084b89b74e051a889ea4eea512984e03ddc8ce4ce6eb2e503c26149055d54e5b1fce674f835219e2f9ae
Resulting secret: ic1SnTZhMCQ13BkfSqaxVeqoSeu3uLUsMgo348iRm7w=
root@ssss:~# # Matches
root@ssss:~#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment