diff --git a/README.md b/README.md index 316cb80..736c018 100644 --- a/README.md +++ b/README.md @@ -49,12 +49,12 @@ sharesafe pvss new --secret encryption.key --threshold 2 --participant rick.pub This command will create: * a share secret and will convert it into a **ChaChaPoly1305** compatible encryption key `encryption.key` (see below); -* for every participant a `.share` file is created: - * `rick.share`: rick's share, encrypted with its public key (only rick's private key can unlock the share); - * `morty.share`: morty's share, encrypted with its public key (only morty's private key can unlock the share); - * `jerry.share`: jerry's share, encrypted with its public key (only jerry's private key can unlock the share); +* for every participant a `.secret-share` file is created: + * `rick.secret-share`: rick's share, encrypted with its public key (only rick's private key can unlock the share); + * `morty.secret-share`: morty's share, encrypted with its public key (only morty's private key can unlock the share); + * `jerry.secret-share`: jerry's share, encrypted with its public key (only jerry's private key can unlock the share); -> the `.share` files can safely be shared over any support, secured or not. +> the `.secret-share` files can safely be shared over any support, secured or not. > They are encrypted a way only the owner of the private key can open it. In this command, the `threshold` is the minimum number of _opened shares_ needed @@ -63,17 +63,17 @@ to recover the `encryption.key`. See next command. #### Recover a secret To recover a shared secret, we need _n_ participants (`threshold`) to open -their `.share`. +their `.secret-share`. ```shell -sharesafe pvss open-share -share rick.share --key rick.key --password "c-137" -o rick.opened-share +sharesafe pvss reveal-share -share rick.secret-share --key rick.key --password "c-137" -o rick.revealed-share ``` In the example above we set the threshold to 2 participants, so to retrieve the secret (`encryption.key`): ```shell -sharesafe pvss recover --share rick.opened-share --share morty.opened-share -o encryption.key +sharesafe pvss recover --share rick.revealed-share --share morty.revealed-share -o encryption.key ``` #### Use the generated/recovered to encrypt or decrypt a file diff --git a/app/Main.hs b/app/Main.hs index d4bd9e1..e81c25d 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -274,7 +274,7 @@ pvssSubProgram = do pvssNewShareSubProgram :: OptionDesc (IO ()) () pvssNewShareSubProgram = command "new" $ do - description "generate a new share secret. The Participant's shares are generated based on the participants's public key filename. (filename -<.> share)" + description "generate a new share secret. The Participant's shares are generated based on the participants's public key filename. (filename -<.> secret-share)" pkssf <- flagMany $ flagParam (FlagShort 'p' <> FlagLong "participant" <> FlagDescription "Public key of the participants") (FlagRequired (Right . fromString)) thresholdf <- flagParam (FlagShort 't' <> FlagLong "threshold" <> FlagDescription "Threshold to retrive the secrets (default: 1)") @@ -301,7 +301,7 @@ pvssNewShareSubProgram = command "new" $ do withFileOr (toParam outf) WriteMode stdout $ \h -> hPut h (B.convertToBase B.Base64 ek) forM_ (zip pkss shares) $ \(fp, share) -> - let fp' = fromString $ filePathToLString fp -<.> "share" + let fp' = fromString $ filePathToLString fp -<.> "secret-share" in withFile fp' WriteMode $ flip hPut (convert $ encodeJSON share) pvssVerifyShareSubProgram :: OptionDesc (IO ()) () @@ -321,7 +321,7 @@ pvssVerifyShareSubProgram = command "verify" $ do unless (verifyShare commitments share) $ error "invalid share" pvssOpenShareSubProgram :: OptionDesc (IO ()) () -pvssOpenShareSubProgram = command "open-share" $ do +pvssOpenShareSubProgram = command "reveal-share" $ do description "open the given share" sharef <- flagParam (FlagShort 's' <> FlagLong "share" <> FlagDescription "Share to verify participant") (FlagRequired (Right . fromString)) diff --git a/tests/sharesafe-test.sh b/tests/sharesafe-test.sh index d4ba605..da88167 100755 --- a/tests/sharesafe-test.sh +++ b/tests/sharesafe-test.sh @@ -34,14 +34,14 @@ ${CMD} pvss new -p rick.pub -p morty.pub -p jerry.pub \ -c commitments \ -o encryption-key -${CMD} pvss verify -s rick.share -c commitments -${CMD} pvss verify -s morty.share -c commitments -${CMD} pvss verify -s jerry.share -c commitments +${CMD} pvss verify -s rick.secret-share -c commitments +${CMD} pvss verify -s morty.secret-share -c commitments +${CMD} pvss verify -s jerry.secret-share -c commitments -${CMD} pvss open-share -s rick.share -k rick.key -o rick.opened-share -${CMD} pvss open-share -s morty.share -k morty.key -o morty.opened-share +${CMD} pvss reveal-share -s rick.secret-share -k rick.key -o rick.revealed-share +${CMD} pvss reveal-share -s morty.secret-share -k morty.key -o morty.revealed-share -${CMD} pvss recover -s $(cat rick.opened-share) -s $(cat morty.opened-share) \ +${CMD} pvss recover -s $(cat rick.revealed-share) -s $(cat morty.revealed-share) \ -o encryption-key.recovered test $(cat encryption-key) = $(cat encryption-key.recovered)