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

address issues raised by Nitin #105

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

doronz2
Copy link

@doronz2 doronz2 commented Dec 10, 2020

No description provided.

@@ -1 +1 @@
{"parties":"3", "threshold":"1"}
{"parties":"3", "threshold":"2"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Any specific reason to change the threshold to 2 here ?

Copy link
Author

Choose a reason for hiding this comment

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

No, I changed it while testing to be consistent with the assumption. Though I don't thing the threshold value is meaningful

Copy link
Contributor

Choose a reason for hiding this comment

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

threshold value is meaningful but not for this demo. So can leave it as is

@@ -67,7 +67,10 @@ pub fn aes_decrypt(key: &[u8], aead_pack: AEAD) -> Vec<u8> {
let nonce: Vec<u8> = repeat(3).take(12).collect();
let aad: [u8; 0] = [];
let mut gcm = AesGcm::new(KeySize256, key, &nonce[..], &aad);
gcm.decrypt(&aead_pack.ciphertext[..], &mut out, &aead_pack.tag[..]);
let successful_decrypt = gcm.decrypt(&aead_pack.ciphertext[..], &mut out, &aead_pack.tag[..]);
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably can just be written as:

        if !gcm.decrypt(&aead_pack.ciphertext[..], &mut out, &aead_pack.tag[..]) {
            panic!("Error: Could not decrypt AES ciphertext");
        }

Copy link
Author

@doronz2 doronz2 Dec 10, 2020

Choose a reason for hiding this comment

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

It's a matter of style, but I can change it as you suggested

Copy link
Contributor

Choose a reason for hiding this comment

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

agreed.

@@ -170,6 +170,11 @@ fn main() {
j += 1;
}
}

assert_eq!(signers_vec.len(), (THRESHOLD + 1) as usize);
if signers_vec.len()> (THRESHOLD + 1) as usize{
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the assert_eq! can just be removed and the if can be changed to:

if signers_vec.len() != (THRESHOLD + 1) as usize{
panic!("For the demo we always sign with minimum number of parties(THRESHOLD + 1). This should not happen.");
}

Copy link
Author

Choose a reason for hiding this comment

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

Why minimum number of parties, shouldn't it be exactly THRESHOLD + 1?

Copy link
Contributor

Choose a reason for hiding this comment

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

that's what I meant by minimum number of parties. You need minimum THRESHOLD + 1 signers to generate a usable signature.

Also this comment is just for style. We don't need an assert and an if statement. Could just use an if statement only.

But that should not stop you from merging this as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants