CiFEr
Data Structures | Typedefs | Functions

// FHIPE represents a Function Hiding Inner Product Encryption scheme based on the paper by Kim, Lewi, Mandal, Montgomery, Roy, Wu: "Function-Hiding Inner Product Encryption is Practical". It allows to encrypt a vector x and derive a secret key based on an inner product vector y so that a deryptor can decrypt the inner product <x,y> without revealing x or y. More...

Go to the source code of this file.

Data Structures

struct  cfe_fhipe
 
struct  cfe_fhipe_sec_key
 
struct  cfe_fhipe_fe_key
 
struct  cfe_fhipe_ciphertext
 

Typedefs

typedef struct cfe_fhipe cfe_fhipe
 
typedef struct cfe_fhipe_sec_key cfe_fhipe_sec_key
 
typedef struct cfe_fhipe_fe_key cfe_fhipe_fe_key
 
typedef struct cfe_fhipe_ciphertext cfe_fhipe_ciphertext
 

Functions

cfe_error cfe_fhipe_init (cfe_fhipe *c, size_t l, mpz_t bound_x, mpz_t bound_y)
 
void cfe_fhipe_copy (cfe_fhipe *res, cfe_fhipe *c)
 
void cfe_fhipe_free (cfe_fhipe *c)
 
void cfe_fhipe_master_key_init (cfe_fhipe_sec_key *sec_key, cfe_fhipe *c)
 
void cfe_fhipe_master_key_free (cfe_fhipe_sec_key *sec_key)
 
cfe_error cfe_fhipe_generate_master_key (cfe_fhipe_sec_key *sec_key, cfe_fhipe *c)
 
void cfe_fhipe_fe_key_init (cfe_fhipe_fe_key *fe_key, cfe_fhipe *c)
 
void cfe_fhipe_fe_key_free (cfe_fhipe_fe_key *fe_key)
 
cfe_error cfe_fhipe_derive_fe_key (cfe_fhipe_fe_key *fe_key, cfe_vec *y, cfe_fhipe_sec_key *sec_key, cfe_fhipe *c)
 
void cfe_fhipe_ciphertext_init (cfe_fhipe_ciphertext *cipher, cfe_fhipe *c)
 
void cfe_fhipe_ciphertext_free (cfe_fhipe_ciphertext *cipher)
 
cfe_error cfe_fhipe_encrypt (cfe_fhipe_ciphertext *cipher, cfe_vec *x, cfe_fhipe_sec_key *sec_key, cfe_fhipe *c)
 
cfe_error cfe_fhipe_decrypt (mpz_t res, cfe_fhipe_ciphertext *cipher, cfe_fhipe_fe_key *fe_key, cfe_fhipe *c)
 

Detailed Description

// FHIPE represents a Function Hiding Inner Product Encryption scheme based on the paper by Kim, Lewi, Mandal, Montgomery, Roy, Wu: "Function-Hiding Inner Product Encryption is Practical". It allows to encrypt a vector x and derive a secret key based on an inner product vector y so that a deryptor can decrypt the inner product <x,y> without revealing x or y.

Typedef Documentation

◆ cfe_fhipe

typedef struct cfe_fhipe cfe_fhipe

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

◆ cfe_fhipe_sec_key

cfe_fhipe_sec_key represents a master secret key in fhipe scheme.

◆ cfe_fhipe_fe_key

cfe_fhipe_fe_key represents a functional encryption key in fhipe scheme.

◆ cfe_fhipe_ciphertext

cfe_fhipe_ciphertext represents a ciphertext in fhipe scheme.

Function Documentation

◆ cfe_fhipe_init()

cfe_error cfe_fhipe_init ( cfe_fhipe c,
size_t  l,
mpz_t  bound_x,
mpz_t  bound_y 
)

Configures a new client for the fhipe 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
lLength of the vectors that will be encrypted
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_fhipe_copy()

void cfe_fhipe_copy ( cfe_fhipe res,
cfe_fhipe c 
)

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

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

◆ cfe_fhipe_free()

void cfe_fhipe_free ( cfe_fhipe 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_fhipe struct)

◆ cfe_fhipe_master_key_init()

void cfe_fhipe_master_key_init ( cfe_fhipe_sec_key sec_key,
cfe_fhipe c 
)

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

Parameters
sec_keyA pointer to an uninitialized cfe_fhipe_sec_key struct
cA pointer to an instance of the scheme (initialized cfe_fhipe struct)

◆ cfe_fhipe_master_key_free()

void cfe_fhipe_master_key_free ( cfe_fhipe_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_fhipe_sec_key struct

◆ cfe_fhipe_generate_master_key()

cfe_error cfe_fhipe_generate_master_key ( cfe_fhipe_sec_key sec_key,
cfe_fhipe c 
)

Generates a master secret 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_fhipe_sec_key struct (the master secret key will be stored here)
cA pointer to an instance of the scheme (initialized cfe_fhipe struct)
Returns
Error code

◆ cfe_fhipe_fe_key_init()

void cfe_fhipe_fe_key_init ( cfe_fhipe_fe_key fe_key,
cfe_fhipe c 
)

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

Parameters
fe_keyA pointer to an uninitialized cfe_fhipe_FE_key struct
cA pointer to an instance of the scheme (initialized cfe_fhipe struct)

◆ cfe_fhipe_fe_key_free()

void cfe_fhipe_fe_key_free ( cfe_fhipe_fe_key fe_key)

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

Parameters
fe_keyA pointer to an initialized cfe_fhipe_FE_key struct

◆ cfe_fhipe_derive_fe_key()

cfe_error cfe_fhipe_derive_fe_key ( cfe_fhipe_fe_key fe_key,
cfe_vec y,
cfe_fhipe_sec_key sec_key,
cfe_fhipe c 
)

Takes a master secret key and input vector 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_fhipe_fe_key struct (the functional encryption key will be stored here)
yA pointer to the inner product vector
sec_keyA pointer to the master secret key
cA pointer to an instance of the scheme (initialized cfe_fhipe struct)
Returns
Error code

◆ cfe_fhipe_ciphertext_init()

void cfe_fhipe_ciphertext_init ( cfe_fhipe_ciphertext cipher,
cfe_fhipe c 
)

Initializes the struct which represents the ciphertext.

Parameters
cipherA pointer to an uninitialized cfe_fhipe_ciphertext struct
cA pointer to an instance of the scheme (initialized cfe_fhipe struct)

◆ cfe_fhipe_ciphertext_free()

void cfe_fhipe_ciphertext_free ( cfe_fhipe_ciphertext cipher)

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

Parameters
cipherA pointer to an initialized cfe_fhipe_ciphertext struct

◆ cfe_fhipe_encrypt()

cfe_error cfe_fhipe_encrypt ( cfe_fhipe_ciphertext cipher,
cfe_vec x,
cfe_fhipe_sec_key sec_key,
cfe_fhipe c 
)

Encrypts input vector x with the provided master secret key. It returns a ciphertext struct. If encryption failed, an error is returned.

Parameters
cipherA pointer to an initialized cfe_fhipe_ciphertext struct (the resulting ciphertext will be stored here)
xA pointer to the plaintext vector
sec_keyA pointer to the master secret key
cA pointer to an instance of the scheme (initialized cfe_fhipe struct)
Returns
Error code

◆ cfe_fhipe_decrypt()

cfe_error cfe_fhipe_decrypt ( mpz_t  res,
cfe_fhipe_ciphertext cipher,
cfe_fhipe_fe_key fe_key,
cfe_fhipe c 
)

Accepts the encrypted vector and functional encryption key. It returns the inner product of x and y. If decryption failed, an error is returned.

Parameters
resThe result of the decryption (the value will be stored here)
cipherA pointer to the ciphertext vector
fe_keyThe functional encryption key
cA pointer to an instance of the scheme (initialized cfe_fhipe struct)
Returns
Error code