fn verify_correct_key_proof(correct_key_proof: &CorrectKeyProof, n: &BigInt) -> Result<(), ()> {
    let sigma = &correct_key_proof.sigma_vec;
    // product of all primes < 6370 (alpha)
    let primorial = BigInt::from_hex("4ddec772c2ee9fb11e7b9ed0e5f6b7de5b83a0f20cfad9f37ec2ad151341ebbe75cb190441855d0d9014efd683716ac93e5e5369e8f72854979e198ba184ad4e7a4ff76b9eff3cd6533e8c5b2c2a5d8bb62ed86d280d2f0fa1666a5454d0e10b5e67c96e809fd3daddab1f77ba6d5dace62a1939d3c729e9f131f84190aa3407d5f02cf23a90a6c50acefbd123c66c5cc78c935883c0cee1435437811496b10a13900f4f59794d67b494c52279e3159330f1d076d623a8b0b59322559d16c68dc6f3d1d377a1668b7f80f945e7407cee358e9a02bb6b983a56e3199156eb40214b098bf3d301bdd132487f1354db3771885772f49fe86f8890668dfb5e5f9b1b677431081875f91cc019461b9cae2825226ae7ffe870658e573401005f331db99eb66ca6c7fa31b6e2838f1a7da59fb7935a619ffab6d0586431993b6a4c32861141d3139015562ea824550e1a26dfcc53085ebd0885742832c4542fc6436591b3f973d6f9cd7235094738734d082ef51af29824940809d660c8d322d4a44fcf43071b8b473d12d36019fee110aa59aaee6ab7426889bfd07073d9ce03476fdbd04cc6479f73500676f2832c6a0a00ad6c832f5309e9803598e41ffb325e6c403f35730887ef0f6e5a91fdc147ce022ef9ab1851550f9ff93115a626b4f9af82c4eabebafe3b52380d0f9f28f2f5961689807934b9e58d1956314334dc71088a6bd907712a38104fd5ad523efcb10d02c76fdb846594e094b3200b3c3956b17d2d555b6375c1c65c3b19fee9f1e8726f9f6f0c4128f2dd4d5fdd7be1261371bc538b2015e4d3d0ce147bcdc0cd561d5fe21a9f0bf91b5804fca0e41d17f5e5bc6d53e94220ebec6816b020306b7dbd9c6320859de0771f89e76c5af81f45aa29086e82148cbbbc6fbe69929288daa640bbb8d01d995e0218b12d70f83b556f0584fb17740a21f12bbd7894790b7d4bbc58f01844c40cb887e6d1817e8254243884a82443fcb9d9c95e3422e2a8b9810c1309d743e8ff2d82de816fea1e13744a40b54da01035e426405cecb4ba960d60ccb2529ae6627f1fe98ce9307eadae3b74f90c57a6a6b0779be0a1fd953a780c46ba19a09a6bdfbb659d42cb7ec1e9917dfbe7da508db6924a0c99acc7b3b40763d7207ebb07f25f21c410726ed1d0a1244346687bbb310a14a6a68edb3843069a987699f9f20a6da72576fa14fbe8f4ed35a6cd8475bed9c70b51a5fd99bbbe1a2ab43df1e51fda1c701e7823db06544545752b927f16fef58b1109ff0c945dfce0a3e7111896eb49b470f37a3326f3a985b00b747bdce7fb5f38812c2973bac4d75218e0fcb1bb8be4ecdf099fb09741e3171ef4ef3ac9f5a05e4fa2baa6b440c99b433ca98afca73b58d9e4088aafc4f95c2277605d172471fd3f745315ef1ab8a17b52b48bad7d28b08081560a6d06fc558c96f3f70694ce26f81a41786b12cfbd79c5e3f99a879ada2d4e79480de14e8b15924777246ef90d210bfec6941a430827d05a0a66b3d6ef95521f114ad7054f369724de2ac44976136285b6f99348cfe802ca6e70470e2d21b3f6645eb6a23b0b98a177201fa3fb87b89312247e").unwrap();
    // check that N is > 0 and not divisable by all the primes < alpha
    if n <= &BigInt::zero() || primorial.gcd(n) != BigInt::one() {
        return Err(());
    }
    // check that sigma indeed consists of m elements
    if sigma.len() != CORRECT_KEY_M {
        return Err(());
    }
    // check that each sigma element is > 0 and that rho_i == sigma_i ^ N mod N
    let rho = correct_key_proof_rho(n);
    for i in 0..sigma.len() {
        if sigma[i] <= BigInt::zero() {
            return Err(());
        }
        if rho[i] != BigInt::mod_pow(&sigma[i], n, n) {
            return Err(());
        }
    }
    Ok(())
}
/// verify proof of correct paillier key generation
/// see paper "Efficient Noninteractive Certification of RSA Moduli and Beyond" by Goldberg et al. 2019 Section 3.2 and Appendix C.4
verify proof of correct paillier key generation
see paper "Efficient Noninteractive Certification of RSA Moduli and Beyond" by Goldberg et al.
verify proof of correct paillier key generation see paper " Efficient Noninteractive Certification of RSA Moduli and Beyond " by Goldberg et al .
fn verify_correct_key_proof(correct_key_proof: &CorrectKeyProof, n: &BigInt) -> Result<(), ()> {
    let sigma = &correct_key_proof.sigma_vec;
    // product of all primes < 6370 (alpha)
    let primorial = BigInt::from_hex("4ddec772c2ee9fb11e7b9ed0e5f6b7de5b83a0f20cfad9f37ec2ad151341ebbe75cb190441855d0d9014efd683716ac93e5e5369e8f72854979e198ba184ad4e7a4ff76b9eff3cd6533e8c5b2c2a5d8bb62ed86d280d2f0fa1666a5454d0e10b5e67c96e809fd3daddab1f77ba6d5dace62a1939d3c729e9f131f84190aa3407d5f02cf23a90a6c50acefbd123c66c5cc78c935883c0cee1435437811496b10a13900f4f59794d67b494c52279e3159330f1d076d623a8b0b59322559d16c68dc6f3d1d377a1668b7f80f945e7407cee358e9a02bb6b983a56e3199156eb40214b098bf3d301bdd132487f1354db3771885772f49fe86f8890668dfb5e5f9b1b677431081875f91cc019461b9cae2825226ae7ffe870658e573401005f331db99eb66ca6c7fa31b6e2838f1a7da59fb7935a619ffab6d0586431993b6a4c32861141d3139015562ea824550e1a26dfcc53085ebd0885742832c4542fc6436591b3f973d6f9cd7235094738734d082ef51af29824940809d660c8d322d4a44fcf43071b8b473d12d36019fee110aa59aaee6ab7426889bfd07073d9ce03476fdbd04cc6479f73500676f2832c6a0a00ad6c832f5309e9803598e41ffb325e6c403f35730887ef0f6e5a91fdc147ce022ef9ab1851550f9ff93115a626b4f9af82c4eabebafe3b52380d0f9f28f2f5961689807934b9e58d1956314334dc71088a6bd907712a38104fd5ad523efcb10d02c76fdb846594e094b3200b3c3956b17d2d555b6375c1c65c3b19fee9f1e8726f9f6f0c4128f2dd4d5fdd7be1261371bc538b2015e4d3d0ce147bcdc0cd561d5fe21a9f0bf91b5804fca0e41d17f5e5bc6d53e94220ebec6816b020306b7dbd9c6320859de0771f89e76c5af81f45aa29086e82148cbbbc6fbe69929288daa640bbb8d01d995e0218b12d70f83b556f0584fb17740a21f12bbd7894790b7d4bbc58f01844c40cb887e6d1817e8254243884a82443fcb9d9c95e3422e2a8b9810c1309d743e8ff2d82de816fea1e13744a40b54da01035e426405cecb4ba960d60ccb2529ae6627f1fe98ce9307eadae3b74f90c57a6a6b0779be0a1fd953a780c46ba19a09a6bdfbb659d42cb7ec1e9917dfbe7da508db6924a0c99acc7b3b40763d7207ebb07f25f21c410726ed1d0a1244346687bbb310a14a6a68edb3843069a987699f9f20a6da72576fa14fbe8f4ed35a6cd8475bed9c70b51a5fd99bbbe1a2ab43df1e51fda1c701e7823db06544545752b927f16fef58b1109ff0c945dfce0a3e7111896eb49b470f37a3326f3a985b00b747bdce7fb5f38812c2973bac4d75218e0fcb1bb8be4ecdf099fb09741e3171ef4ef3ac9f5a05e4fa2baa6b440c99b433ca98afca73b58d9e4088aafc4f95c2277605d172471fd3f745315ef1ab8a17b52b48bad7d28b08081560a6d06fc558c96f3f70694ce26f81a41786b12cfbd79c5e3f99a879ada2d4e79480de14e8b15924777246ef90d210bfec6941a430827d05a0a66b3d6ef95521f114ad7054f369724de2ac44976136285b6f99348cfe802ca6e70470e2d21b3f6645eb6a23b0b98a177201fa3fb87b89312247e").unwrap();
    // check that N is > 0 and not divisable by all the primes < alpha
    if n <= &BigInt::zero() || primorial.gcd(n) != BigInt::one() {
        return Err(());
    }
    // check that sigma indeed consists of m elements
    if sigma.len() != CORRECT_KEY_M {
        return Err(());
    }
    // check that each sigma element is > 0 and that rho_i == sigma_i ^ N mod N
    let rho = correct_key_proof_rho(n);
    for i in 0..sigma.len() {
        if sigma[i] <= BigInt::zero() {
            return Err(());
        }
        if rho[i] != BigInt::mod_pow(&sigma[i], n, n) {
            return Err(());
        }
    }
    Ok(())
}
fn verify_correct_key_proof ( correct_key_proof : & CorrectKeyProof , n : & BigInt ) -> Result < ( ) , ( ) > { let sigma = & correct_key_proof . sigma_vec ; // product of all primes < 6370 (alpha) let primorial = BigInt :: from_hex ( " " ) . unwrap ( ) ; // check that N is > 0 and not divisable by all the primes < alpha if n <= & BigInt :: zero ( ) || primorial . gcd ( n ) != BigInt :: one ( ) { return Err ( ( ) ) ; } // check that sigma indeed consists of m elements if sigma . len ( ) != CORRECT_KEY_M { return Err ( ( ) ) ; } // check that each sigma element is > 0 and that rho_i == sigma_i ^ N mod N let rho = correct_key_proof_rho ( n ) ; for i in 0 .. sigma . len ( ) { if sigma [ i ] <= BigInt :: zero ( ) { return Err ( ( ) ) ; } if rho [ i ] != BigInt :: mod_pow ( & sigma [ i ] , n , n ) { return Err ( ( ) ) ; } } Ok ( ( ) ) }
verify proof of correct paillier key generation
see paper "Efficient Noninteractive Certification of RSA Moduli and Beyond" by Goldberg et al.
verify proof of correct paillier key generation see paper " Efficient Noninteractive Certification of RSA Moduli and Beyond " by Goldberg et al .
correct_key_proof
&CorrectKeyProof
n
&BigInt