multiparty_decrypt

Engine.multiparty_decrypt(ciphertext, decrypted_shares)
Decrypts a ciphertext in multiparty computation, returning the original message as numpy.ndarray.
  • Input:
    • Ciphertext
    • decrypted_shares: an array of DecryptedShares
  • Output:
    • numpy.ndarray
      • The default data type is numpy.double64. If complex numbers were introduced during computation, the output will be in the numpy.complex128 data type.
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(ciphertext, [decrypted_share1, decrypted_share2])