CiFEr
|
// 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) |
// 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.
cfe_fhipe contains the shared choice for parameters on which the functionality of the scheme depend.
typedef struct cfe_fhipe_sec_key cfe_fhipe_sec_key |
cfe_fhipe_sec_key represents a master secret key in fhipe scheme.
typedef struct cfe_fhipe_fe_key cfe_fhipe_fe_key |
cfe_fhipe_fe_key represents a functional encryption key in fhipe scheme.
typedef struct cfe_fhipe_ciphertext cfe_fhipe_ciphertext |
cfe_fhipe_ciphertext represents a ciphertext in fhipe scheme.
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.
c | A pointer to an uninitialized struct representing the scheme |
l | Length of the vectors that will be encrypted |
bound_x | Bound on the inputs of the vectors that will be encrypted |
bound_y | Bound on the inputs of the inner product vectors for which the functional keys will be generated. |
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.
c | A pointer to an instance of the scheme (initialized cfe_fhipe struct) |
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.
sec_key | A pointer to an uninitialized cfe_fhipe_sec_key struct |
c | A pointer to an instance of the scheme (initialized cfe_fhipe struct) |
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.
sec_key | A pointer to an initialized cfe_fhipe_sec_key struct |
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.
sec_key | A pointer to a cfe_fhipe_sec_key struct (the master secret key will be stored here) |
c | A pointer to an instance of the scheme (initialized cfe_fhipe struct) |
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.
fe_key | A pointer to an uninitialized cfe_fhipe_FE_key struct |
c | A pointer to an instance of the scheme (initialized cfe_fhipe struct) |
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.
fe_key | A pointer to an initialized cfe_fhipe_FE_key struct |
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.
fe_key | A pointer to a cfe_fhipe_fe_key struct (the functional encryption key will be stored here) |
y | A pointer to the inner product vector |
sec_key | A pointer to the master secret key |
c | A pointer to an instance of the scheme (initialized cfe_fhipe struct) |
void cfe_fhipe_ciphertext_init | ( | cfe_fhipe_ciphertext * | cipher, |
cfe_fhipe * | c | ||
) |
Initializes the struct which represents the ciphertext.
cipher | A pointer to an uninitialized cfe_fhipe_ciphertext struct |
c | A pointer to an instance of the scheme (initialized cfe_fhipe struct) |
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.
cipher | A pointer to an initialized cfe_fhipe_ciphertext struct |
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.
cipher | A pointer to an initialized cfe_fhipe_ciphertext struct (the resulting ciphertext will be stored here) |
x | A pointer to the plaintext vector |
sec_key | A pointer to the master secret key |
c | A pointer to an instance of the scheme (initialized cfe_fhipe struct) |
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.
res | The result of the decryption (the value will be stored here) |
cipher | A pointer to the ciphertext vector |
fe_key | The functional encryption key |
c | A pointer to an instance of the scheme (initialized cfe_fhipe struct) |