xtrace_sdk.crypto.encryption.homomorphic_base

Attributes

T_CT

T_PT

T_KEY

T_KP

Classes

HomomorphicBase

The Interface which all homomorphic encryption primitives should implement.

Module Contents

xtrace_sdk.crypto.encryption.homomorphic_base.T_CT
xtrace_sdk.crypto.encryption.homomorphic_base.T_PT
xtrace_sdk.crypto.encryption.homomorphic_base.T_KEY
xtrace_sdk.crypto.encryption.homomorphic_base.T_KP
class xtrace_sdk.crypto.encryption.homomorphic_base.HomomorphicBase

Bases: Generic[T_CT, T_PT, T_KP, T_KEY], abc.ABC

The Interface which all homomorphic encryption primitives should implement.

Parameters:

ABC (abc.ABC) – Abstract class

static key_gen(*args, **kwargs)
Abstractmethod:

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

T_KP

Key generation routine.

static encrypt(pt, key)
Abstractmethod:

Parameters:
  • pt (T_PT)

  • key (T_KEY)

Return type:

T_PT

Encrypts a plain text with key

static decrypt(ct, key)
Abstractmethod:

Parameters:
  • ct (T_CT)

  • key (T_KP)

Return type:

T_CT

decrypts a cipher

static add(ct1, ct2, key)
Abstractmethod:

Parameters:
  • ct1 (T_CT)

  • ct2 (T_CT)

  • key (T_KEY)

Return type:

T_CT

homomorphically add two ciphers and return ct3 such that decrypt(ct3)= decrypt(ct1) + decrypt(ct2)

static multiply(ct1, ct2, key)
Abstractmethod:

Parameters:
  • ct1 (T_CT)

  • ct2 (T_CT)

  • key (T_KEY)

Return type:

T_CT

homomorphically multiply two ciphers and return ct3 such that decrypt(ct3)= decrypt(ct1) * decrypt(ct2)

static xor(ct1, ct2, key)
Abstractmethod:

Parameters:
  • ct1 (T_CT)

  • ct2 (T_CT)

  • key (T_KEY)

Return type:

T_CT

homomorphically xor two ciphers and return ct3 such that decrypt(ct3)= decrypt(ct1) ^ decrypt(ct2)