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

Key policy attribute based scheme. More...

Go to the source code of this file.

Data Structures

struct  cfe_gpsw
 
struct  cfe_gpsw_pub_key
 
struct  cfe_gpsw_cipher
 
struct  cfe_gpsw_key
 

Typedefs

typedef struct cfe_gpsw cfe_gpsw
 
typedef struct cfe_gpsw_pub_key cfe_gpsw_pub_key
 
typedef struct cfe_gpsw_cipher cfe_gpsw_cipher
 
typedef struct cfe_gpsw_key cfe_gpsw_key
 

Functions

void cfe_gpsw_init (cfe_gpsw *gpsw, size_t l)
 
void cfe_gpsw_master_keys_init (cfe_gpsw_pub_key *pk, cfe_vec *sk, cfe_gpsw *gpsw)
 
void cfe_gpsw_generate_master_keys (cfe_gpsw_pub_key *pk, cfe_vec *sk, cfe_gpsw *gpsw)
 
void cfe_gpsw_cipher_init (cfe_gpsw_cipher *cipher, size_t num_attrib)
 
void cfe_gpsw_encrypt (cfe_gpsw_cipher *cipher, cfe_gpsw *gpsw, FP12_BN254 *msg, int *gamma, size_t num_attrib, cfe_gpsw_pub_key *pk)
 
void cfe_gpsw_key_init (cfe_gpsw_key *policy_key, cfe_msp *msp)
 
void cfe_gpsw_generate_policy_key (cfe_gpsw_key *key, cfe_gpsw *gpsw, cfe_msp *msp, cfe_vec *sk)
 
void cfe_gpsw_rand_vec_const_sum (cfe_vec *v, mpz_t y, mpz_t p)
 
cfe_error cfe_gpsw_decrypt (FP12_BN254 *res, cfe_gpsw_cipher *cipher, cfe_gpsw_key *key, cfe_gpsw *gpsw)
 
void cfe_gpsw_free (cfe_gpsw *gpsw)
 
void cfe_gpsw_pub_key_free (cfe_gpsw_pub_key *pk)
 
void cfe_gpsw_cipher_free (cfe_gpsw_cipher *cipher)
 
void cfe_gpsw_key_free (cfe_gpsw_key *key)
 

Detailed Description

Key policy attribute based scheme.

This is a key policy (KP) attribute based (ABE) scheme based on Goyal, Pandey, Sahai, Waters: "Attribute-Based Encryption for Fine-Grained Access Control of Encrypted Data" We abbreviated it GPSW scheme to honor the authors. This scheme enables distribution of keys with associated boolean expression (policy) and encrypting ciphertext with associated set of attributes. A key can decrypt a ciphertext if the associated attributes satisfy the policy. This scheme is a PUBLIC-KEY scheme - no master secret key is needed to encrypt the messages.

Typedef Documentation

◆ cfe_gpsw

typedef struct cfe_gpsw cfe_gpsw

cfe_gpsw represents the GPSW scheme.

◆ cfe_gpsw_pub_key

cfe_gpsw_pub_key represents the public key for the GPSW scheme.

◆ cfe_gpsw_cipher

cfe_gpsw_cipher represents the ciphertext structure for the GPSW scheme.

◆ cfe_gpsw_key

typedef struct cfe_gpsw_key cfe_gpsw_key

cfe_gpsw_cipher represents the key structure with all the keys corresponding owned attributes and is needed for the decryption in the GPSW scheme.

Function Documentation

◆ cfe_gpsw_init()

void cfe_gpsw_init ( cfe_gpsw gpsw,
size_t  l 
)

Configures a new instance of the scheme.

Parameters
gpswA pointer to an uninitialized struct representing the scheme
lThe number of attributes that can be used in the scheme.

◆ cfe_gpsw_master_keys_init()

void cfe_gpsw_master_keys_init ( cfe_gpsw_pub_key pk,
cfe_vec sk,
cfe_gpsw gpsw 
)

Initializes the structs which represent the master public and master secret key.

Parameters
pkA pointer to an uninitialized cfe_gpsw_pub_key struct
skA pointer to an uninitialized vector
gpswA pointer to an initialized struct representing the scheme

◆ cfe_gpsw_generate_master_keys()

void cfe_gpsw_generate_master_keys ( cfe_gpsw_pub_key pk,
cfe_vec sk,
cfe_gpsw gpsw 
)

Generates master secret and public key.

Parameters
pkA pointer to a cfe_gpsw_pub_key struct which represents the master public key
skA pointer to a vector which represents the master public key
gpswA pointer to an initialized struct representing the scheme

◆ cfe_gpsw_cipher_init()

void cfe_gpsw_cipher_init ( cfe_gpsw_cipher cipher,
size_t  num_attrib 
)

Initializes the struct which represents the ciphertext.

Parameters
cipherA pointer to an uninitialized cfe_gpsw_cipher struct
num_attribThe number of attributes

◆ cfe_gpsw_encrypt()

void cfe_gpsw_encrypt ( cfe_gpsw_cipher cipher,
cfe_gpsw gpsw,
FP12_BN254 *  msg,
int *  gamma,
size_t  num_attrib,
cfe_gpsw_pub_key pk 
)

The function takes as an input a message given as a string, gamma a set of attributes that can be latter used in a decryption policy, and a public key. It creates an encryption of the message.

Parameters
cipherA pointer to a cfe_gpsw_cipher struct, the ciphertext will be saved here
gpswA pointer to an initialized struct representing the scheme
msgAn element of FP12_BN254 representing the message
gammaA pointer to an array of integers defining which attributes can be used for the decryption policy
num_attribLength of gamma
pkA pointer to an initialized struct representing the public key

◆ cfe_gpsw_key_init()

void cfe_gpsw_key_init ( cfe_gpsw_key policy_key,
cfe_msp msp 
)

Initializes the cfe_gpsw_keys struct which represents the keys for the decryption.

Parameters
policy_keyA pointer to an uninitialized cfe_gpsw_keys struct
mspA pointer to an initialized struct representing the MSP policy

◆ cfe_gpsw_generate_policy_key()

void cfe_gpsw_generate_policy_key ( cfe_gpsw_key key,
cfe_gpsw gpsw,
cfe_msp msp,
cfe_vec sk 
)

The function given a monotone span program (MSP) and the vector of secret keys produces a keys needed for the decryption. In particular, the key can be used to decrypt a ciphertext if and only if the set of attributes attached to the ciphertext satisfy the policy associated to the key.

Parameters
keyA pointer to a vector of elements of the elliptic curve, the keys will be saved here
gpswA pointer to an initialized struct representing the scheme
mspA pointer to an initialized struct representing the MSP policy
skA pointer to an initialized struct representing the secret key

◆ cfe_gpsw_rand_vec_const_sum()

void cfe_gpsw_rand_vec_const_sum ( cfe_vec v,
mpz_t  y,
mpz_t  p 
)

A helping function used in generate_policy_keys.

◆ cfe_gpsw_decrypt()

cfe_error cfe_gpsw_decrypt ( FP12_BN254 *  res,
cfe_gpsw_cipher cipher,
cfe_gpsw_key key,
cfe_gpsw gpsw 
)

The function takes as an input a cipher and keys and tries to decrypt the cipher. If the keys were properly generated, the set of attributes attached to the ciphertext satisfy the policy associated to the key. If this is not possible, i.e. keys are insufficient, the function returns the corresponding error.

Parameters
resAn element of FP12_BN254, the decryption will be saved here
cipherA pointer to an initialized struct representing the ciphertext
keyA pointer to an initialized struct representing the keys for the decryption
gpswA pointer to an initialized struct representing the scheme
Returns
Error code

◆ cfe_gpsw_free()

void cfe_gpsw_free ( cfe_gpsw gpsw)

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

Parameters
gpswA pointer to an instance of the scheme (initialized cfe_gpsw struct)

◆ cfe_gpsw_pub_key_free()

void cfe_gpsw_pub_key_free ( cfe_gpsw_pub_key pk)

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

Parameters
pkA pointer to an instance of the public key (initialized cfe_gpsw_pub_key struct)

◆ cfe_gpsw_cipher_free()

void cfe_gpsw_cipher_free ( cfe_gpsw_cipher cipher)

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

Parameters
cipherA pointer to an instance of the ciphertext (initialized cfe_gpsw_cipher struct)

◆ cfe_gpsw_key_free()

void cfe_gpsw_key_free ( cfe_gpsw_key key)

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

Parameters
keyA pointer to an instance of the decryption keys (initialized cfe_gpsw_keys struct)