fn fill_rpool(client_dh_secrets_str: String, server_dh_publics_str: String, curve: common::Curve, paillier_pk_str: String) -> String {
    let paillier_pk: EncryptionKey = match serde_json::from_str(&paillier_pk_str) {
        Ok(v) => v,
        Err(_) => {
            return serde_json::to_string(&(false, &"error deserializing paillier_pk")).unwrap()
        }
    };
    if curve == common::Curve::Secp256k1 {
        let client_dh_secrets: Vec<Secp256k1Scalar> =
        match serde_json::from_str(&client_dh_secrets_str) {
            Ok(v) => v,
            Err(_) => {
                return serde_json::to_string(&(false, &"error deserializing client_dh_secrets"))
                    .unwrap()
            }
        };
        let server_dh_publics: Vec<Secp256k1Point> =
            match serde_json::from_str(&server_dh_publics_str) {
                Ok(v) => v,
                Err(_) => {
                    return serde_json::to_string(&(
                        false,
                        &"error deserializing server_dh_publics",
                    ))
                    .unwrap()
                }
            };
        match client::fill_rpool_secp256k1(client_dh_secrets, &server_dh_publics, &paillier_pk) {
            Ok(v) => v,
            Err(_) => return serde_json::to_string(&(false, &"error filling rpool")).unwrap(),
        };
    } else if curve == common::Curve::Secp256r1 {
        let client_dh_secrets: Vec<Secp256r1Scalar> =
        match serde_json::from_str(&client_dh_secrets_str) {
            Ok(v) => v,
            Err(_) => {
                return serde_json::to_string(&(false, &"error deserializing client_dh_secrets"))
                    .unwrap()
            }
        };
        let server_dh_publics: Vec<Secp256r1Point> =
            match serde_json::from_str(&server_dh_publics_str) {
                Ok(v) => v,
                Err(_) => {
                    return serde_json::to_string(&(
                        false,
                        &"error deserializing server_dh_publics",
                    ))
                    .unwrap()
                }
            };
        match client::fill_rpool_secp256r1(client_dh_secrets, &server_dh_publics, &paillier_pk) {
            Ok(v) => v,
            Err(_) => return serde_json::to_string(&(false, &"error filling rpool")).unwrap(),
        };
    } else {
        return serde_json::to_string(&(false, &"error: invalid curve")).unwrap();
    }
    serde_json::to_string(&(&true, &"rpool filled successfully")).unwrap()
}
/// Fill pool of random and nonce values to facilitate signature generation with a single message.
/// Input: client_dh_secrets: list of client DH secret values, server_dh_publics: list of server DH public values, curve: Secp256k1 or Secp256r1, paillier_pk: Paillier public key
/// Output: none
Fill pool of random and nonce values to facilitate signature generation with a single message.
Fill pool of random and nonce values to facilitate signature generation with a single message .
fn fill_rpool(client_dh_secrets_str: String, server_dh_publics_str: String, curve: common::Curve, paillier_pk_str: String) -> String {
    let paillier_pk: EncryptionKey = match serde_json::from_str(&paillier_pk_str) {
        Ok(v) => v,
        Err(_) => {
            return serde_json::to_string(&(false, &"error deserializing paillier_pk")).unwrap()
        }
    };
    if curve == common::Curve::Secp256k1 {
        let client_dh_secrets: Vec<Secp256k1Scalar> =
        match serde_json::from_str(&client_dh_secrets_str) {
            Ok(v) => v,
            Err(_) => {
                return serde_json::to_string(&(false, &"error deserializing client_dh_secrets"))
                    .unwrap()
            }
        };
        let server_dh_publics: Vec<Secp256k1Point> =
            match serde_json::from_str(&server_dh_publics_str) {
                Ok(v) => v,
                Err(_) => {
                    return serde_json::to_string(&(
                        false,
                        &"error deserializing server_dh_publics",
                    ))
                    .unwrap()
                }
            };
        match client::fill_rpool_secp256k1(client_dh_secrets, &server_dh_publics, &paillier_pk) {
            Ok(v) => v,
            Err(_) => return serde_json::to_string(&(false, &"error filling rpool")).unwrap(),
        };
    } else if curve == common::Curve::Secp256r1 {
        let client_dh_secrets: Vec<Secp256r1Scalar> =
        match serde_json::from_str(&client_dh_secrets_str) {
            Ok(v) => v,
            Err(_) => {
                return serde_json::to_string(&(false, &"error deserializing client_dh_secrets"))
                    .unwrap()
            }
        };
        let server_dh_publics: Vec<Secp256r1Point> =
            match serde_json::from_str(&server_dh_publics_str) {
                Ok(v) => v,
                Err(_) => {
                    return serde_json::to_string(&(
                        false,
                        &"error deserializing server_dh_publics",
                    ))
                    .unwrap()
                }
            };
        match client::fill_rpool_secp256r1(client_dh_secrets, &server_dh_publics, &paillier_pk) {
            Ok(v) => v,
            Err(_) => return serde_json::to_string(&(false, &"error filling rpool")).unwrap(),
        };
    } else {
        return serde_json::to_string(&(false, &"error: invalid curve")).unwrap();
    }
    serde_json::to_string(&(&true, &"rpool filled successfully")).unwrap()
}
fn fill_rpool ( client_dh_secrets_str : String , server_dh_publics_str : String , curve : common :: Curve , paillier_pk_str : String ) -> String { let paillier_pk : EncryptionKey = match serde_json :: from_str ( & paillier_pk_str ) { Ok ( v ) => v , Err ( _ ) => { return serde_json :: to_string ( & ( false , & " " ) ) . unwrap ( ) } } ; if curve == common :: Curve :: Secp256k1 { let client_dh_secrets : Vec < Secp256k1Scalar > = match serde_json :: from_str ( & client_dh_secrets_str ) { Ok ( v ) => v , Err ( _ ) => { return serde_json :: to_string ( & ( false , & " " ) ) . unwrap ( ) } } ; let server_dh_publics : Vec < Secp256k1Point > = match serde_json :: from_str ( & server_dh_publics_str ) { Ok ( v ) => v , Err ( _ ) => { return serde_json :: to_string ( & ( false , & " " , ) ) . unwrap ( ) } } ; match client :: fill_rpool_secp256k1 ( client_dh_secrets , & server_dh_publics , & paillier_pk ) { Ok ( v ) => v , Err ( _ ) => return serde_json :: to_string ( & ( false , & " " ) ) . unwrap ( ) , } ; } else if curve == common :: Curve :: Secp256r1 { let client_dh_secrets : Vec < Secp256r1Scalar > = match serde_json :: from_str ( & client_dh_secrets_str ) { Ok ( v ) => v , Err ( _ ) => { return serde_json :: to_string ( & ( false , & " " ) ) . unwrap ( ) } } ; let server_dh_publics : Vec < Secp256r1Point > = match serde_json :: from_str ( & server_dh_publics_str ) { Ok ( v ) => v , Err ( _ ) => { return serde_json :: to_string ( & ( false , & " " , ) ) . unwrap ( ) } } ; match client :: fill_rpool_secp256r1 ( client_dh_secrets , & server_dh_publics , & paillier_pk ) { Ok ( v ) => v , Err ( _ ) => return serde_json :: to_string ( & ( false , & " " ) ) . unwrap ( ) , } ; } else { return serde_json :: to_string ( & ( false , & " " ) ) . unwrap ( ) ; } serde_json :: to_string ( & ( & true , & " " ) ) . unwrap ( ) }
Fill pool of random and nonce values to facilitate signature generation with a single message.
Fill pool of random and nonce values to facilitate signature generation with a single message .
client_dh_secrets_str
String
server_dh_publics_str
String
curve
common::Curve
paillier_pk_str
String