xtrace_sdk.crypto.encryption.goldwasser_micali ============================================== .. py:module:: xtrace_sdk.crypto.encryption.goldwasser_micali Attributes ---------- .. autoapisummary:: xtrace_sdk.crypto.encryption.goldwasser_micali.BIT_STRING_LENGTH Classes ------- .. autoapisummary:: xtrace_sdk.crypto.encryption.goldwasser_micali.Goldwasser_Micali Module Contents --------------- .. py:data:: BIT_STRING_LENGTH :value: 1024 .. py:class:: Goldwasser_Micali(keys) Bases: :py:obj:`xtrace_sdk.crypto.encryption.homomorphic_base.HomomorphicBase`\ [\ :py:obj:`list`\ [\ :py:obj:`int`\ ]\ , :py:obj:`list`\ [\ :py:obj:`int`\ ]\ , :py:obj:`xtrace_sdk.utils.xtrace_types.GoldwasserMicaliKeyPair`\ , :py:obj:`xtrace_sdk.utils.xtrace_types.GoldwasserMicaliPublicKey`\ ] A self implemented Goldwasser Micali encryption scheme .. py:attribute:: keys .. py:method:: key_gen(key_len) :staticmethod: Key generation routine for the Goldwasser_Micali crypto scheme. :param key_len: the number of bits in PK SK :type key_len: int :return: Goldwasser_Micali PK, SK pair :rtype: Goldwasser_MicaliKeyPair .. py:method:: generate_random_r(pk) :staticmethod: Helper function for encryption required by Goldwasser_Micali scheme :param pk: the public key :type pk: GoldwasserMicaliPublicKey :return: a random r to be used for encryption. :rtype: int .. py:method:: encrypt(plaintext, pk) :staticmethod: Encryption with PK :param plaintext: the plaintext to be encrypted. :type plaintext: int :param pk: the public key to be used for encryption :type pk: GoldwasserMicaliPublicKey :return: Goldwasser Micali cipher :rtype: int .. py:method:: decrypt(ciphertext, keys) :staticmethod: Decrypts a cihpher with Goldwasser Micali key pair and returns the plaintext :param ciphertext: cipher to be decrypted :type ciphertext: int :param keys: pk,sk pair where sk is used to encrypt ct. :type keys: GoldwasserMicaliKeyPair :return: plaintext :rtype: int .. py:method:: add(ciphertext1, ciphertext2, pk) :staticmethod: :abstractmethod: Not supported for Goldwasser_Micali. .. py:method:: multiply(ciphertext1, ciphertext2, pk) :staticmethod: :abstractmethod: Not supported for Goldwasser_Micali. .. py:method:: xor(ciphertext1, ciphertext2, pk) :staticmethod: Homomorphic xor of Goldwasser_Micali crypto system. :param ciphertext1: one the ciphers to be xor'ed :type ciphertext1: int :param ciphertext2: one the ciphers to be xor'ed :type ciphertext2: int :param pk: Pailier public key :type pk: GoldwasserMicaliPublicKey :return: ciphertext3 such that decrypt(ct3,sk) = decrypt(ct1,sk) [xor] decrypt(ct2,sk) :rtype: int .. py:method:: L(x, n) :staticmethod: Helper method for decryption