multiparty_decrypt_to_plaintext
Engine.multiparty_decrypt_to_plaintext(ciphertext, decrypted_shares)
- Decrypts a ciphertext in multiparty computation without decoding it. A plaintext is returned.
- Input:
- Ciphertext
- decrypted_shares: an array of DecryptedShares
- Output:
- Plaintext
from liberate import Engine
engine = Engine(use_multiparty=True)
secret_key1 = engine.create_secret_key()
secret_key2 = engine.create_secret_key()
public_key_a = engine.create_public_key_a()
public_key_b1 = engine.create_public_key_b(secret_key1, public_key_a)
public_key_b2 = engine.create_public_key_b(secret_key2, public_key_a)
public_key = engine.create_multiparty_public_key([public_key_b1, public_key_b2], public_key_a)
message = [1, 2, 3]
ciphertext = engine.encrypt(message, public_key)
decrypted_share1 = engine.individual_decrypt(ciphertext, secret_key1)
decrypted_share2 = engine.individual_decrypt(ciphertext, secret_key2)
decrypted = engine.multiparty_decrypt_to_plaintext(ciphertext, [decrypted_share1, decrypted_share2])
decoded = engine.decode(decrypted)
While it has little practical use, this function can be used when you want to replicate the API behavior of traditional homomorphic encryption libraries, such as SEAL
, on a 1:1 basis.