|
19 | 19 | elgamal_combine_public_keys, |
20 | 20 | elgamal_keypair_random, |
21 | 21 | ) |
22 | | -from .group import int_to_q, rand_q, ElementModP, ElementModQ |
| 22 | +from .group import hex_to_q, rand_q, ElementModP, ElementModQ |
23 | 23 | from .rsa import rsa_keypair, rsa_decrypt, rsa_encrypt |
24 | 24 | from .schnorr import SchnorrProof, make_schnorr_proof |
25 | 25 | from .serializable import Serializable |
@@ -143,8 +143,7 @@ def generate_elgamal_auxiliary_key_pair() -> AuxiliaryKeyPair: |
143 | 143 | """ |
144 | 144 | elgamal_key_pair = elgamal_keypair_random() |
145 | 145 | return AuxiliaryKeyPair( |
146 | | - str(elgamal_key_pair.secret_key.to_int()), |
147 | | - str(elgamal_key_pair.public_key.to_int()), |
| 146 | + elgamal_key_pair.secret_key.to_hex(), elgamal_key_pair.public_key.to_hex(), |
148 | 147 | ) |
149 | 148 |
|
150 | 149 |
|
@@ -190,7 +189,7 @@ def generate_election_partial_key_backup( |
190 | 189 | value = compute_polynomial_coordinate( |
191 | 190 | auxiliary_public_key.sequence_order, polynomial |
192 | 191 | ) |
193 | | - encrypted_value = encrypt(str(value.to_int()), auxiliary_public_key.key) |
| 192 | + encrypted_value = encrypt(value.to_hex(), auxiliary_public_key.key) |
194 | 193 | if encrypted_value is None: |
195 | 194 | return None |
196 | 195 | return ElectionPartialKeyBackup( |
@@ -240,7 +239,7 @@ def verify_election_partial_key_backup( |
240 | 239 | return ElectionPartialKeyVerification( |
241 | 240 | backup.owner_id, backup.designated_id, verifier_id, False |
242 | 241 | ) |
243 | | - value = get_optional(int_to_q(int(decrypted_value))) |
| 242 | + value = get_optional(hex_to_q(decrypted_value)) |
244 | 243 | return ElectionPartialKeyVerification( |
245 | 244 | backup.owner_id, |
246 | 245 | backup.designated_id, |
|
0 commit comments