CiFEr
|
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) |
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 struct cfe_gpsw_pub_key cfe_gpsw_pub_key |
cfe_gpsw_pub_key represents the public key for the GPSW scheme.
typedef struct cfe_gpsw_cipher cfe_gpsw_cipher |
cfe_gpsw_cipher represents the ciphertext structure for the GPSW scheme.
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.
void cfe_gpsw_init | ( | cfe_gpsw * | gpsw, |
size_t | l | ||
) |
Configures a new instance of the scheme.
gpsw | A pointer to an uninitialized struct representing the scheme |
l | The number of attributes that can be used in the scheme. |
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.
pk | A pointer to an uninitialized cfe_gpsw_pub_key struct |
sk | A pointer to an uninitialized vector |
gpsw | A pointer to an initialized struct representing the scheme |
void cfe_gpsw_generate_master_keys | ( | cfe_gpsw_pub_key * | pk, |
cfe_vec * | sk, | ||
cfe_gpsw * | gpsw | ||
) |
Generates master secret and public key.
pk | A pointer to a cfe_gpsw_pub_key struct which represents the master public key |
sk | A pointer to a vector which represents the master public key |
gpsw | A pointer to an initialized struct representing the scheme |
void cfe_gpsw_cipher_init | ( | cfe_gpsw_cipher * | cipher, |
size_t | num_attrib | ||
) |
Initializes the struct which represents the ciphertext.
cipher | A pointer to an uninitialized cfe_gpsw_cipher struct |
num_attrib | The number of attributes |
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.
cipher | A pointer to a cfe_gpsw_cipher struct, the ciphertext will be saved here |
gpsw | A pointer to an initialized struct representing the scheme |
msg | An element of FP12_BN254 representing the message |
gamma | A pointer to an array of integers defining which attributes can be used for the decryption policy |
num_attrib | Length of gamma |
pk | A pointer to an initialized struct representing the public key |
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.
policy_key | A pointer to an uninitialized cfe_gpsw_keys struct |
msp | A pointer to an initialized struct representing the MSP policy |
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.
key | A pointer to a vector of elements of the elliptic curve, the keys will be saved here |
gpsw | A pointer to an initialized struct representing the scheme |
msp | A pointer to an initialized struct representing the MSP policy |
sk | A pointer to an initialized struct representing the secret key |
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_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.
res | An element of FP12_BN254, the decryption will be saved here |
cipher | A pointer to an initialized struct representing the ciphertext |
key | A pointer to an initialized struct representing the keys for the decryption |
gpsw | A pointer to an initialized struct representing the scheme |
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.
gpsw | A pointer to an instance of the scheme (initialized cfe_gpsw struct) |
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.
pk | A pointer to an instance of the public key (initialized cfe_gpsw_pub_key struct) |
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.
cipher | A pointer to an instance of the ciphertext (initialized cfe_gpsw_cipher struct) |
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.
key | A pointer to an instance of the decryption keys (initialized cfe_gpsw_keys struct) |