Skip to content

Commit 56e7887

Browse files
committed
2P-ECDSA based on class groups
1 parent 1212d83 commit 56e7887

File tree

8 files changed

+944
-8
lines changed

8 files changed

+944
-8
lines changed

Cargo.toml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "multi-party-ecdsa"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
authors = [
55
66
@@ -23,18 +23,20 @@ categories = ["cryptography"]
2323
[lib]
2424
crate-type = ["lib"]
2525

26+
[features]
27+
bin = ["rocket", "rocket_contrib"]
28+
2629
[dependencies]
2730
paillier = { git = "https://github.com/KZen-networks/rust-paillier", tag = "v0.3.0" }
2831
zk-paillier = { git = "https://github.com/KZen-networks/zk-paillier", tag = "v0.2.0" }
2932

33+
3034
hex = "0.3.2"
3135
subtle = {version = "2", features = ["nightly"]}
3236
serde = "1.0"
3337
serde_derive = "1.0"
3438
serde_json = "1.0"
3539
reqwest = {version = "0.9.5", default-features = false}
36-
rocket = { version = "0.4.2", default-features = false }
37-
rocket_contrib = { version = "0.4.2", default-features = false, features = ["json"] }
3840
uuid = { version = "0.7", features = ["v4"] }
3941
rust-crypto = "^0.2"
4042

@@ -47,6 +49,21 @@ features = ["ec_secp256k1"]
4749
git = "https://github.com/KZen-networks/centipede"
4850
tag = "v0.2.0"
4951

52+
[dependencies.class_group]
53+
git = "https://github.com/KZen-networks/class-groups"
54+
tag = "v0.1.3"
55+
56+
[dependencies.rocket]
57+
version = "0.4.2"
58+
default-features = false
59+
optional = true
60+
61+
[dependencies.rocket_contrib]
62+
version = "0.4.2"
63+
default-features = false
64+
features = ["json"]
65+
optional = true
66+
5067
[patch.crates-io]
5168
rust-gmp = { version = "0.5.0", features = ["serde_support"], git = "https://github.com/KZen-networks/rust-gmp" }
5269

src/bin/sm_manager.rs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11
#![feature(proc_macro_hygiene, decl_macro)]
22

33
#[macro_use]
4+
#[cfg(feature = "bin")]
45
extern crate rocket;
6+
#[cfg(feature = "bin")]
7+
extern crate rocket_contrib;
58

69
extern crate reqwest;
7-
extern crate rocket_contrib;
810
extern crate uuid;
911

1012
#[macro_use]
1113
extern crate serde_derive;
1214
extern crate serde;
1315
extern crate serde_json;
1416

17+
#[cfg(feature = "bin")]
1518
use rocket::State;
19+
#[cfg(feature = "bin")]
1620
use rocket_contrib::json::Json;
21+
#[cfg(feature = "bin")]
1722
use std::collections::HashMap;
23+
#[cfg(feature = "bin")]
1824
use std::fs;
25+
#[cfg(feature = "bin")]
1926
use std::str;
27+
#[cfg(feature = "bin")]
2028
use std::sync::RwLock;
29+
#[cfg(feature = "bin")]
2130
use uuid::Uuid;
22-
2331
#[derive(Hash, PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
2432
pub struct TupleKey {
2533
pub first: String,
@@ -49,6 +57,7 @@ pub struct Params {
4957
pub parties: String,
5058
pub threshold: String,
5159
}
60+
#[cfg(feature = "bin")]
5261
#[post("/get", format = "json", data = "<request>")]
5362
fn get(
5463
db_mtx: State<RwLock<HashMap<TupleKey, String>>>,
@@ -67,7 +76,7 @@ fn get(
6776
None => Json(Err(())),
6877
}
6978
}
70-
79+
#[cfg(feature = "bin")]
7180
#[post("/set", format = "json", data = "<request>")]
7281
fn set(
7382
db_mtx: State<RwLock<HashMap<TupleKey, String>>>,
@@ -79,6 +88,7 @@ fn set(
7988
Json(Ok(()))
8089
}
8190

91+
#[cfg(feature = "bin")]
8292
#[post("/signupkeygen", format = "json")]
8393
fn signup_keygen(
8494
db_mtx: State<RwLock<HashMap<TupleKey, String>>>,
@@ -118,6 +128,7 @@ fn signup_keygen(
118128
return Json(Ok(party_signup));
119129
}
120130

131+
#[cfg(feature = "bin")]
121132
#[post("/signupsign", format = "json")]
122133
fn signup_sign(db_mtx: State<RwLock<HashMap<TupleKey, String>>>) -> Json<Result<PartySignup, ()>> {
123134
//read parameters:
@@ -157,8 +168,8 @@ fn signup_sign(db_mtx: State<RwLock<HashMap<TupleKey, String>>>) -> Json<Result<
157168
}
158169

159170
//refcell, arc
160-
161-
fn main() {
171+
#[cfg(feature = "bin")]
172+
fn run_server() {
162173
// let mut my_config = Config::development();
163174
// my_config.set_port(18001);
164175
let db: HashMap<TupleKey, String> = HashMap::new();
@@ -207,3 +218,9 @@ fn main() {
207218
.manage(db_mtx)
208219
.launch();
209220
}
221+
222+
fn main() {
223+
//refcell, arc
224+
#[cfg(feature = "bin")]
225+
run_server()
226+
}

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ extern crate serde_json;
2121
extern crate subtle;
2222

2323
extern crate centipede;
24+
extern crate class_group;
2425
extern crate curv;
2526
extern crate paillier;
2627
extern crate zk_paillier;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
Multi-party ECDSA
3+
4+
Copyright 2018 by Kzen Networks
5+
6+
This file is part of Multi-party ECDSA library
7+
(https://github.com/KZen-networks/multi-party-ecdsa)
8+
9+
Multi-party ECDSA is free software: you can redistribute
10+
it and/or modify it under the terms of the GNU General Public
11+
License as published by the Free Software Foundation, either
12+
version 3 of the License, or (at your option) any later version.
13+
14+
@license GPL-3.0+ <https://github.com/KZen-networks/multi-party-ecdsa/blob/master/LICENSE>
15+
*/
16+
17+
const SECURITY_BITS: usize = 256;
18+
19+
pub mod party_one;
20+
pub mod party_two;
21+
22+
mod test;

0 commit comments

Comments
 (0)