CiFEr
Data Structures | Typedefs | Functions
fh_multi_ipe.h File Reference

// FH-Multi-IPE represents a Function Hiding Multi-client Inner Product Encryption scheme based on the paper by P. Datta, T. Okamoto, and J. Tomida: "Full-Hiding (Unbounded) Multi-Input Inner Product Functional Encryption from the 𝒌-Linear Assumption". It allows clients to encrypt vectors {x_1,...,x_m} and derive a secret key based on an inner product vectors {y_1,...,y_m} so that a decryptor can decrypt the sum of inner products <x_1,y_1> + ... + <x_m, y_m> without revealing vectors x_i or y_i. The scheme is slightly modified from the original one to achieve a better performance. The difference is in storing the secret master key as matrices B_hat, B_hat_star, instead of matrices of elliptic curve elements g_1^B_hat, g_2^B_hat_star. This replaces elliptic curves operations with matrix multiplications. More...

Go to the source code of this file.

Data Structures

struct  cfe_fh_multi_ipe
 
struct  cfe_fh_multi_ipe_sec_key
 

Typedefs

typedef struct cfe_fh_multi_ipe cfe_fh_multi_ipe
 
typedef struct cfe_fh_multi_ipe_sec_key cfe_fh_multi_ipe_sec_key
 

Functions

cfe_error cfe_fh_multi_ipe_init (cfe_fh_multi_ipe *c, size_t sec_level, size_t num_clients, size_t vec_len, mpz_t bound_x, mpz_t bound_y)
 
void cfe_fh_multi_ipe_copy (cfe_fh_multi_ipe *res, cfe_fh_multi_ipe *c)
 
void cfe_fh_multi_ipe_free (cfe_fh_multi_ipe *c)
 
void cfe_fh_multi_ipe_master_key_init (cfe_fh_multi_ipe_sec_key *sec_key, cfe_fh_multi_ipe *c)
 
void cfe_fh_multi_ipe_master_key_free (cfe_fh_multi_ipe_sec_key *sec_key)
 
cfe_error cfe_fh_multi_ipe_generate_keys (cfe_fh_multi_ipe_sec_key *sec_key, FP12_BN254 *pub_key, cfe_fh_multi_ipe *c)
 
void cfe_fh_multi_ipe_fe_key_init (cfe_mat_G2 *fe_key, cfe_fh_multi_ipe *c)
 
cfe_error cfe_fh_multi_ipe_derive_fe_key (cfe_mat_G2 *fe_key, cfe_mat *y, cfe_fh_multi_ipe_sec_key *sec_key, cfe_fh_multi_ipe *c)
 
void cfe_fh_multi_ipe_ciphertext_init (cfe_vec_G1 *cipher, cfe_fh_multi_ipe *c)
 
cfe_error cfe_fh_multi_ipe_encrypt (cfe_vec_G1 *cipher, cfe_vec *x, cfe_mat *part_sec_key, cfe_fh_multi_ipe *c)
 
cfe_error cfe_fh_multi_ipe_decrypt (mpz_t res, cfe_vec_G1 *ciphers, cfe_mat_G2 *fe_key, FP12_BN254 *pub_key, cfe_fh_multi_ipe *c)
 

Detailed Description

// FH-Multi-IPE represents a Function Hiding Multi-client Inner Product Encryption scheme based on the paper by P. Datta, T. Okamoto, and J. Tomida: "Full-Hiding (Unbounded) Multi-Input Inner Product Functional Encryption from the 𝒌-Linear Assumption". It allows clients to encrypt vectors {x_1,...,x_m} and derive a secret key based on an inner product vectors {y_1,...,y_m} so that a decryptor can decrypt the sum of inner products <x_1,y_1> + ... + <x_m, y_m> without revealing vectors x_i or y_i. The scheme is slightly modified from the original one to achieve a better performance. The difference is in storing the secret master key as matrices B_hat, B_hat_star, instead of matrices of elliptic curve elements g_1^B_hat, g_2^B_hat_star. This replaces elliptic curves operations with matrix multiplications.

Typedef Documentation

◆ cfe_fh_multi_ipe

cfe_fh_multi_ipe contains the shared choice for parameters on which the functionality of the scheme depend.

◆ cfe_fh_multi_ipe_sec_key

cfe_fh_multi_ipe_sec_key represents a master secret key in fh_multi_ipe scheme.

Function Documentation

◆ cfe_fh_multi_ipe_init()

cfe_error cfe_fh_multi_ipe_init ( cfe_fh_multi_ipe c,
size_t  sec_level,
size_t  num_clients,
size_t  vec_len,
mpz_t  bound_x,
mpz_t  bound_y 
)

Configures a new client for the fh_multi_ipe scheme. It returns an error if the bounds and length of vectors are too high.

Parameters
cA pointer to an uninitialized struct representing the scheme
sec_levelThe parameter defines the security assumption of the scheme, so called k-Lin assumption, where k is the specified sec_level
num_clientsNumber of clients participating in the scheme
vec_lenLength of the vectors that each client will encrypt
bound_xBound on the inputs of the vectors that will be encrypted
bound_yBound on the inputs of the inner product vectors for which the functional keys will be generated.
Returns
Error code

◆ cfe_fh_multi_ipe_copy()

void cfe_fh_multi_ipe_copy ( cfe_fh_multi_ipe res,
cfe_fh_multi_ipe c 
)

Reconstructs the scheme with the same configuration parameters from an already existing fh_multi_ipe scheme instance.

Parameters
resA pointer to an uninitialized cfe_fh_multi_ipe struct
cA pointer to an instance of the scheme (initialized cfe_fh_multi_ipe struct)

◆ cfe_fh_multi_ipe_free()

void cfe_fh_multi_ipe_free ( cfe_fh_multi_ipe c)

Frees the memory occupied by the struct members. It does not free the memory occupied by the struct itself.

Parameters
cA pointer to an instance of the scheme (initialized cfe_fh_multi_ipe struct)

◆ cfe_fh_multi_ipe_master_key_init()

void cfe_fh_multi_ipe_master_key_init ( cfe_fh_multi_ipe_sec_key sec_key,
cfe_fh_multi_ipe c 
)

Initializes the struct which represents the master secret key in fh_multi_ipe.

Parameters
sec_keyA pointer to an uninitialized cfe_fh_multi_ipe_sec_key struct
cA pointer to an instance of the scheme (initialized cfe_fh_multi_ipe struct)

◆ cfe_fh_multi_ipe_master_key_free()

void cfe_fh_multi_ipe_master_key_free ( cfe_fh_multi_ipe_sec_key sec_key)

Frees the memory occupied by the struct members. It does not free the memory occupied by the struct itself.

Parameters
sec_keyA pointer to an initialized cfe_fh_multi_ipe_sec_key struct

◆ cfe_fh_multi_ipe_generate_keys()

cfe_error cfe_fh_multi_ipe_generate_keys ( cfe_fh_multi_ipe_sec_key sec_key,
FP12_BN254 *  pub_key,
cfe_fh_multi_ipe c 
)

Generates a master secret key and a public key for the scheme. It returns an error if generating one of the parts of the secret key failed.

Parameters
sec_keyA pointer to a cfe_fh_multi_ipe_sec_key struct (the master secret key will be stored here)
pub_keyA pointer to a FH12_BN256 struct (the public key will be stored here)
cA pointer to an instance of the scheme (initialized cfe_fh_multi_ipe struct)
Returns
Error code

◆ cfe_fh_multi_ipe_fe_key_init()

void cfe_fh_multi_ipe_fe_key_init ( cfe_mat_G2 fe_key,
cfe_fh_multi_ipe c 
)

Initializes the struct which represents the functional encryption key in fh_multi_ipe.

Parameters
fe_keyA pointer to an uninitialized cfe_mat_G2 struct
cA pointer to an instance of the scheme (initialized cfe_fh_multi_ipe struct)

◆ cfe_fh_multi_ipe_derive_fe_key()

cfe_error cfe_fh_multi_ipe_derive_fe_key ( cfe_mat_G2 fe_key,
cfe_mat y,
cfe_fh_multi_ipe_sec_key sec_key,
cfe_fh_multi_ipe c 
)

Takes a master secret key and input matrix y, and derives the functional encryption key. In case the key could not be derived, it returns an error.

Parameters
fe_keyA pointer to a cfe_mat_G2 struct (the functional encryption key will be stored here)
yA pointer to the inner product matrix
sec_keyA pointer to the master secret key
cA pointer to an instance of the scheme (initialized cfe_fh_multi_ipe struct)
Returns
Error code

◆ cfe_fh_multi_ipe_ciphertext_init()

void cfe_fh_multi_ipe_ciphertext_init ( cfe_vec_G1 cipher,
cfe_fh_multi_ipe c 
)

Initializes the struct which represents the ciphertext.

Parameters
cipherA pointer to an uninitialized cfe_vec_G1 struct
cA pointer to an instance of the scheme (initialized cfe_fh_multi_ipe struct)

◆ cfe_fh_multi_ipe_encrypt()

cfe_error cfe_fh_multi_ipe_encrypt ( cfe_vec_G1 cipher,
cfe_vec x,
cfe_mat part_sec_key,
cfe_fh_multi_ipe c 
)

The function is called by a client that encrypts input vector x with the provided part master secret key. It returns a ciphertext struct. If encryption failed, an error is returned.

Parameters
cipherA pointer to an initialized cfe_vec_G1 struct (the resulting ciphertext will be stored here)
xA pointer to the plaintext vector
part_sec_keyA pointer to a matrix representing a part of the master secret key (i-th client gets i-th matrix in array B_hat)
cA pointer to an instance of the scheme (initialized cfe_fh_multi_ipe struct)
Returns
Error code

◆ cfe_fh_multi_ipe_decrypt()

cfe_error cfe_fh_multi_ipe_decrypt ( mpz_t  res,
cfe_vec_G1 ciphers,
cfe_mat_G2 fe_key,
FP12_BN254 *  pub_key,
cfe_fh_multi_ipe c 
)

Accepts the encrypted vectors and functional encryption key. It returns the inner product of x and y, i.e. <x_1,y_1> + ... + <x_m, y_m> where x_i is i-th encrypted vector and y_i is i-th inner product vector (i-th row of y). If decryption failed, an error is returned.

Parameters
resThe result of the decryption (the value will be stored here)
ciphersAn array of the ciphertexts
fe_keyA pointer to the functional encryption key
pub_keyA pointer to the public key
cA pointer to an instance of the scheme (initialized cfe_fh_multi_ipe struct)
Returns
Error code