Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.1.0 candidate - support for EdDSA, Schnorr & fix dependencies #34

Merged
merged 33 commits into from
Oct 27, 2019
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
97d0346
move all api to 'ecdsa' in preparation to more protocols
Jun 3, 2019
efac5b1
integration-tests pass
Jun 4, 2019
fdb6839
integration-tests work with schnorr
Jun 4, 2019
e08ad4b
PrivateShare::get_child
Jun 5, 2019
73dd8e7
fix dependency for multi-party-schnorr
Jun 5, 2019
148af99
fix dependency for multi-party-schnorr #2
Jun 5, 2019
a2034f8
fix dependency for multi-party-schnorr #3
Jun 5, 2019
3e97481
info! prints to debug!
Jun 6, 2019
47d0100
two-party EdDSA works
oleiba Jul 4, 2019
14bd425
support EdDSA
oleiba Jul 7, 2019
b54301c
dedicated Eddsa prefix to structs
oleiba Jul 7, 2019
1e4246b
dynamoDB compatible table names, add customerId for EddsaAggPublicKey
oleiba Jul 11, 2019
da4b5ef
change rust nightly in Docker
oleiba Jul 11, 2019
68ee548
Adding EdDSA client key generation to C interface + Merge server rec…
boazarad88 Jul 15, 2019
ab5f762
fix: exposing eddsa::{KeyAgg, KeyPair}
oleiba Jul 15, 2019
1143ab9
logs & fixes
oleiba Jul 21, 2019
b3abf7a
logs & fixes
oleiba Jul 21, 2019
44cafaa
remove prints
oleiba Jul 22, 2019
8bdd0ef
Adding C headers for eddsa::sign (#32)
boazarad88 Aug 4, 2019
f21a4ba
Replacing all panics with error returns in sign functions. (#33)
boazarad88 Aug 20, 2019
ecc6a66
update dependencies
oleiba Aug 29, 2019
163a56b
Revert "update dependencies"
oleiba Sep 1, 2019
52672e1
use branches feature/libra-support-fix
oleiba Sep 1, 2019
1534d99
fix compilation error integration-tests
oleiba Sep 1, 2019
73b86df
fix dependencies tags
oleiba Sep 2, 2019
d1876f9
update to use [email protected], [email protected], rocket@dcea956 (ring 0.14)
oleiba Aug 29, 2019
c388082
fix dependencies tags
oleiba Sep 5, 2019
a7cdc19
Adding integration test in Docker
gbenattar Sep 9, 2019
9878684
Adding integration test in Docker
gbenattar Sep 9, 2019
273b202
multi-party-eddsa: tag = "[email protected]"
oleiba Sep 18, 2019
b225d04
Merge commit '987868451848940ce7f97a8ca4f448eebac9d100' into v0.1.0
oleiba Sep 18, 2019
5c2eccc
multi-party-eddsa: tag [email protected]
oleiba Sep 24, 2019
0e3bd43
[email protected]
oleiba Oct 2, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions gotham-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[package]
name = "gotham-client"
version = "0.1.0"
authors = ["gbenattar <[email protected]>"]
authors = [
"gbenattar <[email protected]>",
"Oded Leiba <[email protected]"
]
edition = "2018"

[lib]
Expand All @@ -21,32 +24,42 @@ log = "0.4"
time = "*"
clap = { version = "2.32", features = ["yaml"] }
reqwest = "0.9.5"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#28 ?

failure = "0.1.5"
uuid = { version = "0.7", features = ["v4"] }
electrumx_client = { git = "https://github.com/KZen-networks/rust-electrumx-client" }
electrumx_client = { git = "https://github.com/KZen-networks/rust-electrumx-client", tag = "[email protected]" }
itertools = "0.8.0"
hex = "0.3.2"
bitcoin = "0.16.0"
bitcoin = "0.20.0"
config = "0.9"

[dependencies.secp256k1]
version = "0.12"
features = ["rand", "serde"]

[dependencies.zk-paillier]
git = "https://github.com/KZen-networks/zk-paillier"
tag = "v0.2.0"

[dependencies.kms]
git = "https://github.com/KZen-networks/kms"
git = "https://github.com/KZen-networks/kms-secp256k1"
tag = "v0.1.0"

[dependencies.multi-party-ecdsa]
git = "https://github.com/KZen-networks/multi-party-ecdsa"
tag = "v0.1.0"

[dependencies.multi-party-ed25519]
git = "https://github.com/KZen-networks/multi-party-eddsa"
branch = "alt-curv-v0.2.0"

[dependencies.multi-party-schnorr]
git = "https://github.com/KZen-networks/multi-party-schnorr"
tag = "v0.3.0"

[dependencies.curv]
git = "https://github.com/KZen-networks/curv"
tag = "v0.2.0"
features = ["ec_secp256k1"]

[patch.crates-io]
rust-gmp = { version = "0.5.0", features = ["serde_support"], git = "https://github.com/KZen-networks/rust-gmp" }

[dependencies.centipede]
git = "https://github.com/KZen-networks/centipede"
git = "https://github.com/KZen-networks/centipede"
tag = "v0.2.0"
149 changes: 0 additions & 149 deletions gotham-client/src/api/mod.rs

This file was deleted.

69 changes: 45 additions & 24 deletions gotham-client/src/ecdsa/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,28 @@ use kms::chain_code::two_party as chain_code;
use kms::ecdsa::two_party::*;
use multi_party_ecdsa::protocols::two_party_ecdsa::lindell_2017::*;

use super::super::api;
use super::types::PrivateShare;
use super::super::utilities::requests;
use super::super::ClientShim;

// iOS bindings
use std::ffi::{CStr, CString};
use std::os::raw::c_char;

const KG_PATH_PRE: &str = "ecdsa/keygen";

pub fn get_master_key(client_shim: &api::ClientShim) -> api::PrivateShare {
pub fn get_master_key(client_shim: &ClientShim) -> PrivateShare {
let start = PreciseTime::now();

let res_body = requests::post(client_shim, &format!("{}/first", KG_PATH_PRE)).unwrap();

let (id, kg_party_one_first_message): (String, party_one::KeyGenFirstMsg) =
serde_json::from_str(&res_body).unwrap();
requests::post(client_shim, &format!("{}/first", KG_PATH_PRE)).unwrap();

let (kg_party_two_first_message, kg_ec_key_pair_party2) = MasterKey2::key_gen_first_message();

let body = &kg_party_two_first_message.d_log_proof;

let res_body =
requests::postb(client_shim, &format!("{}/{}/second", KG_PATH_PRE, id), body).unwrap();

let kg_party_one_second_message: party1::KeyGenParty1Message2 =
serde_json::from_str(&res_body).unwrap();
requests::postb(client_shim, &format!("{}/{}/second", KG_PATH_PRE, id), body).unwrap();

let key_gen_second_message = MasterKey2::key_gen_second_message(
&kg_party_one_first_message,
Expand All @@ -48,23 +48,17 @@ pub fn get_master_key(client_shim: &api::ClientShim) -> api::PrivateShare {

let body = &party_two_second_message.pdl_first_message;

let res_body =
requests::postb(client_shim, &format!("{}/{}/third", KG_PATH_PRE, id), body).unwrap();

let party_one_third_message: party_one::PDLFirstMessage =
serde_json::from_str(&res_body).unwrap();
requests::postb(client_shim, &format!("{}/{}/third", KG_PATH_PRE, id), body).unwrap();

let pdl_decom_party2 = MasterKey2::key_gen_third_message(&party_two_pdl_chal);

let party_2_pdl_second_message = pdl_decom_party2;

let body = &party_2_pdl_second_message;

let res_body =
requests::postb(client_shim, &format!("{}/{}/fourth", KG_PATH_PRE, id), body).unwrap();

let party_one_pdl_second_message: party_one::PDLSecondMessage =
serde_json::from_str(&res_body).unwrap();
requests::postb(client_shim, &format!("{}/{}/fourth", KG_PATH_PRE, id), body).unwrap();

MasterKey2::key_gen_fourth_message(
&party_two_pdl_chal,
Expand All @@ -73,28 +67,24 @@ pub fn get_master_key(client_shim: &api::ClientShim) -> api::PrivateShare {
)
.expect("pdl error party1");

let res_body = requests::post(
let cc_party_one_first_message: Party1FirstMessage = requests::post(
client_shim,
&format!("{}/{}/chaincode/first", KG_PATH_PRE, id),
)
.unwrap();

let cc_party_one_first_message: Party1FirstMessage = serde_json::from_str(&res_body).unwrap();

let (cc_party_two_first_message, cc_ec_key_pair2) =
chain_code::party2::ChainCode2::chain_code_first_message();

let body = &cc_party_two_first_message.d_log_proof;

let res_body = requests::postb(
let cc_party_one_second_message: Party1SecondMessage = requests::postb(
client_shim,
&format!("{}/{}/chaincode/second", KG_PATH_PRE, id),
body,
)
.unwrap();

let cc_party_one_second_message: Party1SecondMessage = serde_json::from_str(&res_body).unwrap();

let cc_party_two_second_message = chain_code::party2::ChainCode2::chain_code_second_message(
&cc_party_one_first_message,
&cc_party_one_second_message,
Expand All @@ -121,5 +111,36 @@ pub fn get_master_key(client_shim: &api::ClientShim) -> api::PrivateShare {
let end = PreciseTime::now();
println!("(id: {}) Took: {}", id, start.to(end));

api::PrivateShare { id, master_key }
PrivateShare { id, master_key }
}

#[no_mangle]
pub extern "C" fn get_client_master_key(
c_endpoint: *const c_char,
c_auth_token: *const c_char,
) -> *mut c_char {
let raw_endpoint = unsafe { CStr::from_ptr(c_endpoint) };
let endpoint = match raw_endpoint.to_str() {
Ok(s) => s,
Err(_) => panic!("Error while decoding raw endpoint"),
};

let raw_auth_token = unsafe { CStr::from_ptr(c_auth_token) };
let auth_token = match raw_auth_token.to_str() {
Ok(s) => s,
Err(_) => panic!("Error while decoding auth token"),
};

let client_shim = ClientShim::new(endpoint.to_string(), Some(auth_token.to_string()));

let private_share: PrivateShare = get_master_key(&client_shim);

let private_share_json = match serde_json::to_string(&private_share) {
Ok(share) => share,
Err(_) => panic!("Error while performing keygen to endpoint {}", endpoint),
};

CString::new(private_share_json.to_owned())
.unwrap()
.into_raw()
}
7 changes: 7 additions & 0 deletions gotham-client/src/ecdsa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@
pub mod keygen;
pub mod rotate;
pub mod sign;
pub mod types;
pub mod recover;

pub use keygen::get_master_key;
pub use rotate::rotate_master_key;
pub use sign::sign;
pub use types::PrivateShare;
Loading