def ciphertext_serialization()

in src/ppxgboost/PaillierAPI.py [0:0]


def ciphertext_serialization(public_key, encrypted_number):
    """
    EncryptedNumber:
    ciphertext (int) – encrypted representation of the encoded number.
    exponent (int) – used by EncodedNumber to keep track of fixed precision. Usually negative.
    Exponent will be zero when encrypting an integer.
    :param public_key: the public key
    :param encrypted_number: encrypted ciphertext
    :return:
    """
    encrypt_with_pub_key = {'public_key': {'n': public_key.n},
                            'values': [str(encrypted_number.ciphertext()), encrypted_number.exponent]}
    serialised = json.dumps(encrypt_with_pub_key)
    return serialised