diff --git a/bindings/netstandard/ElectionGuard/ElectionGuard.Encryption.Tests/TestChaumPedersen.cs b/bindings/netstandard/ElectionGuard/ElectionGuard.Encryption.Tests/TestChaumPedersen.cs index f6f9884..6e8075e 100644 --- a/bindings/netstandard/ElectionGuard/ElectionGuard.Encryption.Tests/TestChaumPedersen.cs +++ b/bindings/netstandard/ElectionGuard/ElectionGuard.Encryption.Tests/TestChaumPedersen.cs @@ -10,13 +10,13 @@ public class TestChaumPedersen [Test] public void Test_DisjunctiveChaumPedersen() { - var nonce = Constants.ONE_MOD_Q; + var nonce = new ElementModQ(Constants.ONE_MOD_Q.Data); var keyPair = ElGamalKeyPair.FromSecret(Constants.TWO_MOD_Q); const ulong vote = 0UL; var ciphertext = Elgamal.Encrypt(vote, nonce, keyPair.PublicKey); var proof = new DisjunctiveChaumPedersenProof( - ciphertext, nonce, keyPair.PublicKey, Constants.ONE_MOD_Q, vote); + ciphertext, nonce, keyPair.PublicKey, new ElementModQ(Constants.ONE_MOD_Q.Data), vote); Assert.That(proof.IsValid(ciphertext, keyPair.PublicKey, Constants.ONE_MOD_Q)); } diff --git a/bindings/netstandard/ElectionGuard/ElectionGuard.Encryption.Tests/TestElection.cs b/bindings/netstandard/ElectionGuard/ElectionGuard.Encryption.Tests/TestElection.cs index 65ad7ef..88b5ec1 100644 --- a/bindings/netstandard/ElectionGuard/ElectionGuard.Encryption.Tests/TestElection.cs +++ b/bindings/netstandard/ElectionGuard/ElectionGuard.Encryption.Tests/TestElection.cs @@ -27,7 +27,7 @@ public void Test_Can_Create_Party() "2022-holidays", new InternationalizedText(new[] { candidateName }), "new-years-id", - null, + string.Empty, false); diff --git a/src/electionguard/encrypt.cpp b/src/electionguard/encrypt.cpp index 31136a1..e6aa92a 100644 --- a/src/electionguard/encrypt.cpp +++ b/src/electionguard/encrypt.cpp @@ -510,8 +510,7 @@ namespace electionguard make_unique(*sharedNonce->clone(), "constant-extended-data"); auto extendedDataNonce = noncesForExtendedData->get(0); - vector extendedData_plaintext( - (uint8_t *)&extendedData.front(), (uint8_t *)&extendedData.front() + extendedData.size()); + vector extendedData_plaintext(extendedData.begin(), extendedData.end()); // Perform HashedElGamalCiphertext calculation unique_ptr hashedElGamal = diff --git a/test/electionguard/test_encrypt.cpp b/test/electionguard/test_encrypt.cpp index ea5a853..37ef23e 100644 --- a/test/electionguard/test_encrypt.cpp +++ b/test/electionguard/test_encrypt.cpp @@ -141,6 +141,7 @@ TEST_CASE("Encrypt PlaintextBallot with EncryptionMediator against constructed " // Assert CHECK(ciphertext->isValidEncryption(*context->getManifestHash(), *keypair->getPublicKey(), *context->getCryptoExtendedBaseHash()) == true); + CHECK(ciphertext->getContests().front().get().getHashedElGamalCiphertext().get() != nullptr); } TEST_CASE("Encrypt PlaintextBallot undervote succeeds") @@ -490,7 +491,6 @@ TEST_CASE("Verify placeholder flag") auto ciphertext = encryptBallot(*ballot, *internal, *context, *device->getHash()); // Assert - // TODO: compare other values CHECK( ciphertext->getContests().front().get().getSelections().front().get().getIsPlaceholder() == false);