Skip to content

Commit

Permalink
Replace the use of ssss-split ssss-combine commands for ssss-rs
Browse files Browse the repository at this point in the history
  • Loading branch information
aitorpazos committed Apr 21, 2021
1 parent 9527d8d commit e5e5784
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 39 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
hal
# scrypt-rs binary
scrypt-rs
# ssss-rs binary
ssss-rs

# IDEs
.idea
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.9.0] - 2021-04-22

### Changed

- [ssss-combine and ssss-split](http://point-at-infinity.org/ssss/) replaced by [ssss-rs](https://github.com/aitorpazos/ssss-rs)
command

## [0.8.1] - 2021-03-28

### Added
Expand Down
22 changes: 15 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
CREATE_DEBIAN_ISO_VERSION:=0.2.0
HAL_VERSION:=0.6.1
HAL_RPM_FILE:=hal-bitcoin-$(HAL_VERSION)-1.el7.x86_64.rpm
SCRYPT_RS_VERSION:=0.2.0
SCRYPT_RS_VERSION:=0.3.0
SCRYPT_RS_TARBALL_FILE:=scrypt-rs-amd64-v$(SCRYPT_RS_VERSION).tar.gz
SSSS_RS_VERSION:=0.1.0
SSSS_RS_TARBALL_FILE:=ssss-rs-amd64-v$(SSSS_RS_VERSION).tar.gz
EXTRACT_DIR:=/tmp/shamir-iso-files

.PHONY: all
all: minimal xfce

.PHONY: clean
clean:
rm -rf hal scrypt-rs
rm -rf files-{min,xfce}/config/{hal,scrypt-rs}
rm -rf hal scrypt-rs ssss-rs
rm -rf files-{min,xfce}/config/{hal,scrypt-rs,ssss-rs}
sudo rm -rf files-{min,xfce}/debian-custom.iso

hal:
Expand All @@ -26,16 +28,22 @@ scrypt-rs:
(cd $(EXTRACT_DIR); tar -xvf scrypt-rs.tar.gz)
cp $(EXTRACT_DIR)/scrypt-rs ./scrypt-rs

ssss-rs:
mkdir -p $(EXTRACT_DIR)
curl -L -o $(EXTRACT_DIR)/ssss-rs.tar.gz https://github.com/aitorpazos/ssss-rs/releases/download/v$(SSSS_RS_VERSION)/$(SSSS_RS_TARBALL_FILE)
(cd $(EXTRACT_DIR); tar -xvf ssss-rs.tar.gz)
cp $(EXTRACT_DIR)/ssss-rs ./ssss-rs

.PHONY: minimal
minimal: files-min/custom-debian.iso

.PHONY: xfce
xfce: files-xfce/custom-debian.iso

files-min/custom-debian.iso: hal scrypt-rs
cp hal scrypt-rs files-min/config/
files-min/custom-debian.iso: hal scrypt-rs ssss-rs
cp hal scrypt-rs ssss-rs files-min/config/
docker run --rm -t -v $(shell pwd)/files-min:/root/files aitorpazos/create-debian-iso:$(CREATE_DEBIAN_ISO_VERSION)

files-xfce/custom-debian.iso: hal scrypt-rs
cp hal scrypt-rs files-xfce/config/
files-xfce/custom-debian.iso: hal scrypt-rs ssss-rs
cp hal scrypt-rs ssss-rs files-xfce/config/
docker run --rm -t -v $(shell pwd)/files-xfce:/root/files aitorpazos/create-debian-iso:$(CREATE_DEBIAN_ISO_VERSION)
27 changes: 12 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,41 +38,38 @@ in your firmware options**

### Split a key

To split a given key use the `ssss-split` command setting how many shares you want to create and how many of them are needed
To split a given key use the `ssss-rs split` command setting how many shares you want to create and how many of them are needed
to recover the original key. Example where the key is divided in 5 pieces and can be recovered with any of 3 pieces):

```shell
echo "hello world" | ssss-split -t 3 -n 5
echo "hello world" | ssss-rs split -t3 -s5 -i -
```

Output:

```
Generating shares using a (3,5) scheme with dynamic security level.
Enter the secret, at most 128 ASCII characters: Using a 48 bit security level.
1-79f847d32bc7d404219fe0
2-358a7ebd071055db71670f
3-ce9914f9142d07c513d320
4-e937954b216efe6ffb2379
5-1224ff0f3253ac71999744
017ec708e757c335e716f36b
0274d0d41038183484dfffd0
036272b09b00fb760cbb60df
049091dc4b5de9c00fbcbf89
058633b8c0650a8287d82086
```

### Recover a key

To recover a key from the splitted keys, you can run the following command (using above split):

```shell
ssss-combine -t 3
ssss-rs combine 0274d0d41038183484dfffd0 049091dc4b5de9c00fbcbf89 058633b8c0650a8287d82086
```

Output:

```
Enter 3 shares separated by newlines:
Share [1/3]: 2-358a7ebd071055db71670f
Share [2/3]: 4-e937954b216efe6ffb2379
Share [3/3]: 5-1224ff0f3253ac71999744
Resulting secret: hello world
Recovered key: hello world
Recovered key in base64: aGVsbG8gd29ybGQ=
Error decoding key to hex (expected for non hexadecimal keys): OddLength
BIP39 words list generation skipped
```

### BIP39 Keys
Expand Down
11 changes: 4 additions & 7 deletions files-min/config/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ These commands are only provided to try to help you in the use of this image.

They may or may not suit your needs.
- Split a key in n number of pieces that you can recover with any x number of them (max 128 characters):
echo "My key" | ssss-split -t <x> -n <n>
echo "My key" | ssss-rs split -t <x> -s <n> -i -
- Recover the key from t number of pieces:
ssss-combine -t <t>
- If the key is longer than 128 characters, you can split it into n number of pieces using the following
command:
split -n <n> <my file with the key>
ssss-rs combine <shares space separated>
- Generate scrypt derived keys
echo "My passphrase" | scrypt-rs -l<generated key length> -s <salt string>
- Generate a QR image:
Expand All @@ -20,10 +17,10 @@ display <qr file.png>
zbarcam --raw

If you are dealing with BIP39 word lists or seeds you can use the `hal` command:
hal bip39 get-seed "your BIP words" | jq -r .entropy | ssss-split -t <x> -n <n>
hal bip39 get-seed "your BIP words" | jq -r .entropy | ssss-rs split -t <x> -s <n> -i -

In order to recover the original words, you can run:
ssss-combine -t <t>
ssss-rs combine <shares space separated>
and then generate the words from the returned value:
hal bip39 generate -w <number of words> --entropy <entropy value>

Expand Down
3 changes: 2 additions & 1 deletion files-min/config/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ apt-get purge -y iproute2 iputils-ping
cp /root/shamir-background.png /usr/share/pixmaps/shamir-background.png
cp /root/hal /usr/bin/
cp /root/scrypt-rs /usr/bin/
chmod a+rx /usr/bin/hal /usr/bin/scrypt-rs
cp /root/ssss-rs /usr/bin/
chmod a+rx /usr/bin/hal /usr/bin/scrypt-rs /usr/bin/ssss-rs

cat > /etc/systemd/system/user-autologin.service << EOF
[Unit]
Expand Down
Binary file modified files-min/config/shamir-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 5 additions & 8 deletions files-xfce/config/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
These commands are only provided to try to help you in the use of this image.

They may or may not suit your needs.
- Split a key in n number of pieces that you can recover with any x number of them (max 128 characters):
echo "My key" | ssss-split -t <x> -n <n>
- Split a key in n number of pieces that you can recover with any x number of them:
echo "My key" | ssss-rs split -t <x> -s <n> -i -
- Recover the key from t number of pieces:
ssss-combine -t <t>
- If the key is longer than 128 characters, you can split it into n number of pieces using the following
command:
split -n <n> <my file with the key>
ssss-rs combine <shares space separated>
- Generate scrypt derived keys
echo "My passphrase" | scrypt-rs -l<generated key length> -s <salt string>
- Generate a QR image:
Expand All @@ -20,10 +17,10 @@ display <qr file.png>
zbarcam --raw

If you are dealing with BIP39 word lists or seeds you can use the `hal` command:
hal bip39 get-seed "your BIP words" | jq -r .entropy | ssss-split -t <x> -n <n>
hal bip39 get-seed "your BIP words" | jq -r .entropy | ssss-rs split -t <x> -s <n> -i -

In order to recover the original words, you can run:
ssss-combine -t <t>
ssss-rs combine <shares space separated>
and then generate the words from the returned value:
hal bip39 generate -w <number of words> --entropy <entropy value>

Expand Down
3 changes: 2 additions & 1 deletion files-xfce/config/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ chmod a+r /usr/share/pixmaps/shamir-background.png

cp /root/hal /usr/bin/
cp /root/scrypt-rs /usr/bin/
cp /root/ssss-rs /usr/bin/
cp /root/create-key-share-card /usr/bin/
chmod a+rx /usr/bin/hal /usr/bin/scrypt-rs /usr/bin/create-key-share-card
chmod a+rx /usr/bin/hal /usr/bin/scrypt-rs /usr/bin/ssss-rs /usr/bin/create-key-share-card

cat > /etc/skel/.config/epiphany/web-extension-settings.ini << EOF
[org/gnome/epiphany]
Expand Down
Binary file modified files-xfce/config/shamir-background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified shamir-background.kra
Binary file not shown.

0 comments on commit e5e5784

Please sign in to comment.