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

Public keys #6

Open
charleschege opened this issue Jul 14, 2021 · 7 comments
Open

Public keys #6

charleschege opened this issue Jul 14, 2021 · 7 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@charleschege
Copy link
Contributor

How are the public keys for the participants generated? Would it be possible to switch them to a new algorithm like Ed25519 for Public Key generation?

@charleschege
Copy link
Contributor Author

From what I can tell, currently, the generated public/private key pair is 2048 bit in length. Is it a custom implementation of a public key generation algorithm?

Can we speed it up by allowing public/private key pairs using more efficient algorithms like Ed25519?

@AlexiaChen
Copy link
Owner

public key generated on More Modular Exponential (MODP) Diffie-Hellman groups, it's also prime order group like ECC points cycle group https://tools.ietf.org/html/rfc3526 . I mentioned before, now, it does not meet the requirement for production enviroment. ECC groups are plan in the future. you can try to change code for Ed25519 using Rust trait, this can adding more curves including secp256k1 or twisted Edward Curve(Ed25519 Curve)

the impl is here

mpvss-rs/src/mpvss.rs

Lines 81 to 100 in 214c1d1

pub fn generate_private_key(&self) -> BigInt {
let mut rng = rand::thread_rng();
let mut privkey: BigUint =
rng.gen_biguint_below(&self.q.to_biguint().unwrap());
// We need the private key and q-1 to be coprime so that we can calculate 1/key mod (q-1) during secret reconstruction.
while privkey
.gcd(&(self.q.clone().to_biguint().unwrap() - BigUint::one()))
!= BigUint::one()
{
privkey = rng.gen_biguint_below(&self.q.to_biguint().unwrap());
}
privkey.to_bigint().unwrap()
}
/// generate public key from private key
/// P = G^k over the Group of the order q
pub fn generate_public_key(&self, privkey: &BigInt) -> BigInt {
// publicKey = G^privKey mod q
self.G.modpow(privkey, &self.q)
}

There is no restriction on the specific structure of the group in the PVSS paper, It only needs to be a prime order group

@AlexiaChen AlexiaChen added enhancement New feature or request question Further information is requested labels Jul 14, 2021
@AlexiaChen
Copy link
Owner

Sorry. This was indeed my previous plan: to support more curves(you can check README), but since this project is an amateur one, that feature is not supported now. So there is no specific time point for this feature to be supported. Thank you for your feedback

@AlexiaChen
Copy link
Owner

Is this an urgent issue for you?

If you know something about cryptography, you should be able to check my implementation code and add a configurable function for generating a secret key pair algorithm (since many curves have Rust implementations already), but it takes quite a bit of time.

@charleschege
Copy link
Contributor Author

Not urgent, I will keep you informed when I need a production implementation

@AlexiaChen
Copy link
Owner

AlexiaChen commented Jul 14, 2021

Yes, this project is an implementation of the PVSS thesis, mainly because the PVSS algorithm does not focus on specific curves and was first done as an attempt to make a prototype. In fact, the PVSS paper is not too difficult, you can look at the README inside the references provided, in particular, <how to share secret> which is an earlier paper that helps you understand the implementation code。 finally try to read <A Simple Publicly Verifiable Secret Sharing Scheme and its Application to Electronic Voting>

@AlexiaChen
Copy link
Owner

But rest assured, the key pair algorithm here is not my own invention and is safe. It just may not meet your needs. If you need to be faster, you can consider using libgmp acceleration. Because here modpow these operations are slower.

hope these informations can help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants