Paillier scheme.
More...
Go to the source code of this file.
|
cfe_error | cfe_paillier_init (cfe_paillier *s, size_t l, size_t lambda, size_t bit_len, mpz_t bound_x, mpz_t bound_y) |
|
void | cfe_paillier_free (cfe_paillier *s) |
|
void | cfe_paillier_copy (cfe_paillier *res, cfe_paillier *s) |
|
void | cfe_paillier_master_keys_init (cfe_vec *msk, cfe_vec *mpk, cfe_paillier *s) |
|
cfe_error | cfe_paillier_generate_master_keys (cfe_vec *msk, cfe_vec *mpk, cfe_paillier *s) |
|
cfe_error | cfe_paillier_derive_fe_key (mpz_t fe_key, cfe_paillier *s, cfe_vec *msk, cfe_vec *y) |
|
void | cfe_paillier_ciphertext_init (cfe_vec *ciphertext, cfe_paillier *s) |
|
cfe_error | cfe_paillier_encrypt (cfe_vec *ciphertext, cfe_paillier *s, cfe_vec *x, cfe_vec *mpk) |
|
cfe_error | cfe_paillier_decrypt (mpz_t res, cfe_paillier *s, cfe_vec *ciphertext, mpz_t key, cfe_vec *y) |
|
◆ cfe_paillier
◆ cfe_paillier_init()
cfe_error cfe_paillier_init |
( |
cfe_paillier * |
s, |
|
|
size_t |
l, |
|
|
size_t |
lambda, |
|
|
size_t |
bit_len, |
|
|
mpz_t |
bound_x, |
|
|
mpz_t |
bound_y |
|
) |
| |
Initializes a new instance of the scheme. It accepts the length of input vectors l, security parameter lambda, the bit length of prime numbers (giving security to the scheme, it should be such that factoring two primes with such a bit length takes at least 2^lambda operations), and boundX and boundY by which coordinates of input vectors and inner product vectors are bounded. It returns an error in the case the scheme could not be properly configured, or if the precondition boundX, boundY < (n / l)^(1/2) is not satisfied.
- Parameters
-
s | A pointer to an uninitialized struct representing the scheme |
l | The length of input vectors |
lambda | The security parameter |
bit_len | Number of bits for generating prime numbers |
bound_x | The bound by which the coordinates of encrypted vectors are bounded |
bound_y | The bound by which the coordinates of inner product vectors are bounded |
- Returns
- Error code
◆ cfe_paillier_free()
Frees the memory occupied by the struct members. It does not free memory occupied by the struct itself.
- Parameters
-
s | A pointer to an instance of the scheme (initialized cfe_paillier struct) |
◆ cfe_paillier_copy()
Reconstructs the scheme with the same configuration parameters from an already existing Paillier scheme instance.
- Parameters
-
res | A pointer to an uninitialized paillier struct |
s | A pointer to an instance of the scheme (initialized cfe_paillier struct) |
◆ cfe_paillier_master_keys_init()
Initializes the vectors which represent the master secret key and master public key.
- Parameters
-
msk | A pointer to an uninitialized vector |
mpk | A pointer to an uninitialized vector |
s | A pointer to an instance of the scheme (initialized cfe_paillier struct) |
◆ cfe_paillier_generate_master_keys()
Generates a master secret key and master public key for the scheme.
- Parameters
-
msk | A pointer to a vector (master secret key will be stored here) |
mpk | A pointer to a vector (master public key will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_paillier struct) |
- Returns
- Error code
◆ cfe_paillier_derive_fe_key()
Takes master secret key and input vector y, and returns the functional encryption key. In case the key could not be derived, it returns an error.
- Parameters
-
fe_key | The resulting functional encryption key (the value will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_paillier struct) |
msk | A pointer to the master secret key |
y | A pointer to the inner product vector |
- Returns
- Error code
◆ cfe_paillier_ciphertext_init()
Initializes the vector which represents the ciphertext.
- Parameters
-
ciphertext | A pointer to an uninitialized vector |
s | A pointer to an instance of the scheme (initialized cfe_paillier struct) |
◆ cfe_paillier_encrypt()
Encrypts input vector x with the provided master public key. It returns a ciphertext vector. If encryption failed, an error is returned.
- Parameters
-
ciphertext | A pointer to a vector (the resulting ciphertext will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_paillier struct) |
x | A pointer to the input vector |
mpk | A pointer to the master public key |
- Returns
- Error code
◆ cfe_paillier_decrypt()
Accepts the encrypted vector, functional encryption key, and a plaintext vector y. It returns the inner product of x and y. If decryption failed, an error is returned.
- Parameters
-
res | The result of the decryption (the value will be stored here) |
s | A pointer to an instance of the scheme (initialized cfe_paillier struct) |
ciphertext | A pointer to the ciphertext vector |
key | The functional encryption key |
y | A pointer to the inner product vector |
- Returns
- Error code