@@ -1248,21 +1248,43 @@ TEST_CASE_METHOD(TestFixture, "Test decryption share for threshold encryption",
1248
1248
libff::alt_bn128_Fr key = libff::alt_bn128_Fr (
1249
1249
" 6507625568967977077291849236396320012317305261598035438182864059942098934847" );
1250
1250
1251
- libff::alt_bn128_G2 decryption_value = libff::alt_bn128_G2::random_element ();
1252
- decryption_value. to_affine_coordinates ();
1251
+ libff::alt_bn128_G2 decryption_value1 = libff::alt_bn128_G2::random_element ();
1252
+ libff::alt_bn128_G2 decryption_value2 = libff::alt_bn128_G2::random_element ();
1253
1253
1254
- auto decrytion_value_str = convertG2ToString ( decryption_value, ' : ' );
1255
- auto decryption_share = c. getDecryptionShare ( name, decrytion_value_str )[ " decryptionShare " ] ;
1254
+ decryption_value1. to_affine_coordinates ( );
1255
+ decryption_value2. to_affine_coordinates () ;
1256
1256
1257
- libff::alt_bn128_G2 share ;
1258
- share. Z = libff::alt_bn128_Fq2::one ( );
1257
+ auto decrytion_value_str1 = convertG2ToString ( decryption_value1, ' : ' ) ;
1258
+ auto decrytion_value_str2 = convertG2ToString ( decryption_value2, ' : ' );
1259
1259
1260
- share.X .c0 = libff::alt_bn128_Fq ( decryption_share[0 ].asCString () );
1261
- share.X .c1 = libff::alt_bn128_Fq ( decryption_share[1 ].asCString () );
1262
- share.Y .c0 = libff::alt_bn128_Fq ( decryption_share[2 ].asCString () );
1263
- share.Y .c1 = libff::alt_bn128_Fq ( decryption_share[3 ].asCString () );
1260
+ Json::Value publicDecryptionValues;
1261
+ publicDecryptionValues[" publicDecryptionValues" ][0 ] = decrytion_value_str1;
1262
+ publicDecryptionValues[" publicDecryptionValues" ][1 ] = decrytion_value_str2;
1264
1263
1265
- REQUIRE ( share == key * decryption_value );
1264
+ auto decryptionShares = c.getDecryptionShares ( name, publicDecryptionValues );
1265
+
1266
+ auto decryption_share1 = decryptionShares[" decryptionShares" ][0 ];
1267
+ auto decryption_share2 = decryptionShares[" decryptionShares" ][1 ];
1268
+
1269
+ libff::alt_bn128_G2 share1;
1270
+ share1.Z = libff::alt_bn128_Fq2::one ();
1271
+
1272
+ share1.X .c0 = libff::alt_bn128_Fq ( decryption_share1[0 ].asCString () );
1273
+ share1.X .c1 = libff::alt_bn128_Fq ( decryption_share1[1 ].asCString () );
1274
+ share1.Y .c0 = libff::alt_bn128_Fq ( decryption_share1[2 ].asCString () );
1275
+ share1.Y .c1 = libff::alt_bn128_Fq ( decryption_share1[3 ].asCString () );
1276
+
1277
+ REQUIRE ( share1 == key * decryption_value1 );
1278
+
1279
+ libff::alt_bn128_G2 share2;
1280
+ share2.Z = libff::alt_bn128_Fq2::one ();
1281
+
1282
+ share2.X .c0 = libff::alt_bn128_Fq ( decryption_share2[0 ].asCString () );
1283
+ share2.X .c1 = libff::alt_bn128_Fq ( decryption_share2[1 ].asCString () );
1284
+ share2.Y .c0 = libff::alt_bn128_Fq ( decryption_share2[2 ].asCString () );
1285
+ share2.Y .c1 = libff::alt_bn128_Fq ( decryption_share2[3 ].asCString () );
1286
+
1287
+ REQUIRE ( share2 == key * decryption_value2 );
1266
1288
}
1267
1289
1268
1290
TEST_CASE_METHOD (TestFixture, " Test decryption share for threshold encryption via zmq" , " [te-decryption-share-zmq]" ) {
@@ -1277,21 +1299,43 @@ TEST_CASE_METHOD(TestFixture, "Test decryption share for threshold encryption vi
1277
1299
libff::alt_bn128_Fr key = libff::alt_bn128_Fr (
1278
1300
" 6507625568967977077291849236396320012317305261598035438182864059942098934847" );
1279
1301
1280
- libff::alt_bn128_G2 decryption_value = libff::alt_bn128_G2::random_element ();
1281
- decryption_value.to_affine_coordinates ();
1302
+ libff::alt_bn128_G2 decryption_value1 = libff::alt_bn128_G2::random_element ();
1303
+ libff::alt_bn128_G2 decryption_value2 = libff::alt_bn128_G2::random_element ();
1304
+
1305
+ decryption_value1.to_affine_coordinates ();
1306
+ decryption_value2.to_affine_coordinates ();
1307
+
1308
+ auto decrytion_value_str1 = convertG2ToString ( decryption_value1, ' :' );
1309
+ auto decrytion_value_str2 = convertG2ToString ( decryption_value2, ' :' );
1310
+
1311
+ Json::Value publicDecryptionValues;
1312
+ publicDecryptionValues[" publicDecryptionValues" ][0 ] = decrytion_value_str1;
1313
+ publicDecryptionValues[" publicDecryptionValues" ][1 ] = decrytion_value_str2;
1314
+
1315
+ auto decryptionShares = client->getDecryptionShares ( name, publicDecryptionValues );
1316
+
1317
+ auto decryption_share1 = decryptionShares[0 ];
1318
+ auto decryption_share2 = decryptionShares[1 ];
1319
+
1320
+ libff::alt_bn128_G2 share1;
1321
+ share1.Z = libff::alt_bn128_Fq2::one ();
1322
+
1323
+ share1.X .c0 = libff::alt_bn128_Fq ( decryption_share1[0 ].asCString () );
1324
+ share1.X .c1 = libff::alt_bn128_Fq ( decryption_share1[1 ].asCString () );
1325
+ share1.Y .c0 = libff::alt_bn128_Fq ( decryption_share1[2 ].asCString () );
1326
+ share1.Y .c1 = libff::alt_bn128_Fq ( decryption_share1[3 ].asCString () );
1282
1327
1283
- auto decrytion_value_str = convertG2ToString ( decryption_value, ' :' );
1284
- auto decryption_share = client->getDecryptionShare ( name, decrytion_value_str );
1328
+ REQUIRE ( share1 == key * decryption_value1 );
1285
1329
1286
- libff::alt_bn128_G2 share ;
1287
- share .Z = libff::alt_bn128_Fq2::one ();
1330
+ libff::alt_bn128_G2 share2 ;
1331
+ share2 .Z = libff::alt_bn128_Fq2::one ();
1288
1332
1289
- share .X .c0 = libff::alt_bn128_Fq ( decryption_share [0 ].asCString () );
1290
- share .X .c1 = libff::alt_bn128_Fq ( decryption_share [1 ].asCString () );
1291
- share .Y .c0 = libff::alt_bn128_Fq ( decryption_share [2 ].asCString () );
1292
- share .Y .c1 = libff::alt_bn128_Fq ( decryption_share [3 ].asCString () );
1333
+ share2 .X .c0 = libff::alt_bn128_Fq ( decryption_share2 [0 ].asCString () );
1334
+ share2 .X .c1 = libff::alt_bn128_Fq ( decryption_share2 [1 ].asCString () );
1335
+ share2 .Y .c0 = libff::alt_bn128_Fq ( decryption_share2 [2 ].asCString () );
1336
+ share2 .Y .c1 = libff::alt_bn128_Fq ( decryption_share2 [3 ].asCString () );
1293
1337
1294
- REQUIRE ( share == key * decryption_value );
1338
+ REQUIRE ( share2 == key * decryption_value2 );
1295
1339
}
1296
1340
1297
1341
TEST_CASE_METHOD (TestFixtureZMQSign, " ZMQ-ecdsa" , " [zmq-ecdsa]" ) {
0 commit comments