Skip to content

Commit

Permalink
Add support for Ed25519 key generation
Browse files Browse the repository at this point in the history
Fixes #6

Add support for Ed25519 key generation in the MPVSS implementation.

* **src/mpvss.rs**
  - Import `ed25519_dalek` crate for Ed25519 key generation.
  - Add `KeyAlgorithm` enum to represent key generation algorithms.
  - Update `MPVSS` struct to include `key_algorithm` field.
  - Add `generate_ed25519_keypair` function to generate Ed25519 key pairs.
  - Update `generate_private_key` and `generate_public_key` functions to support both original and Ed25519 algorithms.

* **README.md**
  - Update "Initialization" section to include Ed25519 key generation.
  - Add a note about Ed25519 key generation in the "In the futures" section.

* **tests/mpvss_tests.rs**
  - Add `test_ed25519_key_generation` function to verify Ed25519 key generation.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/AlexiaChen/mpvss-rs/issues/6?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
AlexiaChen committed Dec 31, 2024
1 parent 98b8963 commit 88e2b6a
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 335 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ p2.initialize();
p3.initialize();
```

To generate Ed25519 key pairs, you can use the `generate_ed25519_keypair` function:

```rust
use ed25519_dalek::{Keypair, PublicKey, SecretKey, Signature, Signer};

let (secret_key, public_key) = generate_ed25519_keypair();
```

#### Distribution & Verification

The dealer splits the secret into shares, encrypts them and creates a proof so that everybody can verify that the shares (once decrypted) can be used to reconstruct the secret. The threshold determines how many shares are necessary for the reconstruction. The encrypted shares and the proof are then bundled together.
Expand Down Expand Up @@ -143,6 +151,8 @@ assert_eq!(secret_message.clone(), r3_str);

Add more Elliptic Curves groups.

Note: Ed25519 key generation is now supported.

## Related References:

- Berry Schoenmakers. [A Simple Publicly Verifiable Secret Sharing Scheme and its Application to Electronic Voting](https://www.win.tue.nl/~berry/papers/crypto99.pdf)
Expand All @@ -168,4 +178,4 @@ Because the ploynomial commitments does not Pedersen commitment and DLEQ is only
## License
Dual-licensed to be compatible with the Rust project.

Licensed under the Apache License, Version 2.0 [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) or the MIT license [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT), at your option. This file may not be copied, modified, or distributed except according to those terms.
Licensed under the Apache License, Version 2.0 [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) or the MIT license [http://opensource.org/licenses/MIT](http://opensource.org/licenses/MIT), at your option. This file may not be copied, modified, or distributed except according to those terms.
Loading

0 comments on commit 88e2b6a

Please sign in to comment.