Reapply "broker: Allow custom mizaru key count & bits"
This reverts commit 89d062b1f0
.
This commit is contained in:
parent
b589f15761
commit
0517629c26
1 changed files with 5 additions and 5 deletions
|
@ -35,14 +35,14 @@ fn default_key_count() -> usize {
|
|||
}
|
||||
|
||||
impl SecretKey {
|
||||
pub fn generate(name: &str) -> Self {
|
||||
pub fn generate(name: &str, key_count: usize, key_bits: usize) -> Self {
|
||||
let count = AtomicUsize::new(1);
|
||||
let rsa_keys: Vec<brs::SecretKey> = (0..key_count)
|
||||
.into_par_iter()
|
||||
.map(|_| {
|
||||
let count = count.fetch_add(1, Ordering::Relaxed);
|
||||
eprintln!("generating {name} {count}/{KEY_COUNT}");
|
||||
brs::KeyPair::generate(&mut rand::thread_rng(), KEY_BITS)
|
||||
eprintln!("generating {name} {count}/{key_count}");
|
||||
brs::KeyPair::generate(&mut rand::thread_rng(), key_bits)
|
||||
.unwrap()
|
||||
.sk
|
||||
})
|
||||
|
@ -244,13 +244,13 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_generate_secret_key() {
|
||||
let secret_key = SecretKey::generate("test_generate_secret_key");
|
||||
let secret_key = SecretKey::generate("test_generate_secret_key", KEY_COUNT, KEY_BITS);
|
||||
assert_eq!(secret_key.rsa_keys_der.len(), KEY_COUNT);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_blind_sign() {
|
||||
let secret_key = SecretKey::generate("test_blind_sign");
|
||||
let secret_key = SecretKey::generate("test_blind_sign", KEY_COUNT, KEY_BITS);
|
||||
let token = ClientToken::random();
|
||||
let (blinded_digest, _secret) =
|
||||
token.blind(&secret_key.get_subkey(0).public_key().unwrap());
|
||||
|
|
Loading…
Reference in a new issue