CiFEr
|
This is a ciphertext policy (CP) attribute based (ABE) scheme based on Shashank Agrawal and Melissa Chase: "FAME: Fast Attribute-based Message Encryption" This scheme enables encrypting a message based on a boolean expression determining which attributes are needed for an entity to be able to decrypt. Each key is connected to some attribute, such that only a set of keys whose attributes are sufficient can decrypt the massage. This scheme is a PUBLIC-KEY scheme - no master secret key is needed to encrypt the messages. More...
Go to the source code of this file.
Data Structures | |
struct | cfe_fame |
struct | cfe_fame_pub_key |
struct | cfe_fame_sec_key |
struct | cfe_fame_cipher |
struct | cfe_fame_attrib_keys |
Typedefs | |
typedef struct cfe_fame | cfe_fame |
typedef struct cfe_fame_pub_key | cfe_fame_pub_key |
typedef struct cfe_fame_sec_key | cfe_fame_sec_key |
typedef struct cfe_fame_cipher | cfe_fame_cipher |
typedef struct cfe_fame_attrib_keys | cfe_fame_attrib_keys |
Functions | |
void | cfe_fame_init (cfe_fame *fame) |
void | cfe_fame_free (cfe_fame *fame) |
void | cfe_fame_sec_key_init (cfe_fame_sec_key *sk) |
void | cfe_fame_sec_key_free (cfe_fame_sec_key *sk) |
void | cfe_fame_generate_master_keys (cfe_fame_pub_key *pk, cfe_fame_sec_key *sk, cfe_fame *fame) |
void | cfe_fame_cipher_init (cfe_fame_cipher *cipher, cfe_msp *msp) |
void | cfe_fame_cipher_free (cfe_fame_cipher *cipher) |
void | cfe_fame_encrypt (cfe_fame_cipher *cipher, FP12_BN254 *msg, cfe_msp *msp, cfe_fame_pub_key *pk, cfe_fame *fame) |
void | cfe_fame_attrib_keys_init (cfe_fame_attrib_keys *keys, size_t num_attrib) |
void | cfe_fame_attrib_keys_free (cfe_fame_attrib_keys *keys) |
void | cfe_fame_generate_attrib_keys (cfe_fame_attrib_keys *keys, int *gamma, size_t num_attrib, cfe_fame_sec_key *sk, cfe_fame *fame) |
cfe_error | cfe_fame_decrypt (FP12_BN254 *res, cfe_fame_cipher *cipher, cfe_fame_attrib_keys *keys, cfe_fame *fame) |
This is a ciphertext policy (CP) attribute based (ABE) scheme based on Shashank Agrawal and Melissa Chase: "FAME: Fast Attribute-based Message Encryption" This scheme enables encrypting a message based on a boolean expression determining which attributes are needed for an entity to be able to decrypt. Each key is connected to some attribute, such that only a set of keys whose attributes are sufficient can decrypt the massage. This scheme is a PUBLIC-KEY scheme - no master secret key is needed to encrypt the messages.
typedef struct cfe_fame_pub_key cfe_fame_pub_key |
cfe_fame_pub_key represents the public key for the FAME scheme.It does not need to be manually initialized by an initialization function.
typedef struct cfe_fame_sec_key cfe_fame_sec_key |
cfe_fame_sec_key represents the secret key for the FAME scheme.
typedef struct cfe_fame_cipher cfe_fame_cipher |
cfe_fame_cipher represents the cipher for the FAME scheme.
typedef struct cfe_fame_attrib_keys cfe_fame_attrib_keys |
cfe_fame_attrib_keys represents the keys corresponding to attributes needed for the decryption.
void cfe_fame_init | ( | cfe_fame * | fame | ) |
Configures a new instance of the scheme.
fame | A pointer to an uninitialized struct representing the scheme |
void cfe_fame_free | ( | cfe_fame * | fame | ) |
Frees the memory occupied by the struct members. It does not free the memory occupied by the struct itself.
fame | A pointer to an instance of the scheme (initialized cfe_fame struct) |
void cfe_fame_sec_key_init | ( | cfe_fame_sec_key * | sk | ) |
Initializes a secret key.
sk | A pointer to an uninitialized struct representing the secret key |
void cfe_fame_sec_key_free | ( | cfe_fame_sec_key * | sk | ) |
Frees the memory occupied by the struct members. It does not free the memory occupied by the struct itself.
sk | A pointer to an instance of the secret key (initialized cfe_fame_sec_key struct) |
void cfe_fame_generate_master_keys | ( | cfe_fame_pub_key * | pk, |
cfe_fame_sec_key * | sk, | ||
cfe_fame * | fame | ||
) |
Generates a master secret key and a public key.
pk | A pointer to a cfe_fame_pub_key struct, the public key will be saved here; pk does not need to be manually initialized by an initialization function |
sk | A pointer to an initialized cfe_fame_sec_key struct, the secret key will be saved here |
fame | A pointer to an initialized struct representing the scheme |
void cfe_fame_cipher_init | ( | cfe_fame_cipher * | cipher, |
cfe_msp * | msp | ||
) |
Initializes the ciphertext that will be generated given a MSP structure. A MSP structure is needed to decide how much memory needs to be allocated.
cipher | A pointer to an uninitialized struct representing the ciphertext |
msp | A pointer to an initialized struct representing the MSP policy |
void cfe_fame_cipher_free | ( | cfe_fame_cipher * | 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 instance of the ciphertext (initialized cfe_fame_cipher struct) |
void cfe_fame_encrypt | ( | cfe_fame_cipher * | cipher, |
FP12_BN254 * | msg, | ||
cfe_msp * | msp, | ||
cfe_fame_pub_key * | pk, | ||
cfe_fame * | fame | ||
) |
The function takes as an input a message, a MSP structure describing a policy which attributes are needed for the decryption, and a public key. It creates an encryption of the message.
cipher | A pointer to an initialized cfe_fame_cipher struct, the encryption will be saved here |
msg | An element of FP12_BN254 representing the message |
msp | A pointer to an initialized struct representing the MSP policy |
pk | A pointer to an initialized struct representing the public key |
fame | A pointer to an initialized struct representing the scheme |
void cfe_fame_attrib_keys_init | ( | cfe_fame_attrib_keys * | keys, |
size_t | num_attrib | ||
) |
Initializes attribute keys needed for the decryption. The number of attributes needs to be specified to decide how much memory needs to be allocated.
keys | A pointer to an uninitialized struct representing the keys |
num_attrib | The number of attributes that the keys will contain |
void cfe_fame_attrib_keys_free | ( | cfe_fame_attrib_keys * | keys | ) |
Frees the memory occupied by the struct members. It does not free the memory occupied by the struct itself.
keys | A pointer to an instance of attribute keys (initialized cfe_fame_attrib_keys struct) |
void cfe_fame_generate_attrib_keys | ( | cfe_fame_attrib_keys * | keys, |
int * | gamma, | ||
size_t | num_attrib, | ||
cfe_fame_sec_key * | sk, | ||
cfe_fame * | fame | ||
) |
The function given an array of attributes and master secret keys creates keys corresponding to attributes that can be used for the decryption.
keys | A pointer to an initialized cfe_fame_attrib_keys struct, the keys for the decryption will be saved here |
gamma | An array of attributes for which keys will be generated |
num_attrib | Length of the array gamma, i.e. the number of attributes |
sk | A pointer to a struct representing the secret keys |
fame | A pointer to an initialized struct representing the scheme |
cfe_error cfe_fame_decrypt | ( | FP12_BN254 * | res, |
cfe_fame_cipher * | cipher, | ||
cfe_fame_attrib_keys * | keys, | ||
cfe_fame * | fame | ||
) |
The function takes as an input a cipher and keys and tries to decrypt the cipher. If the keys were properly generated, this is possible if and only if the rows of the MSP matrix corresponding to owned attributes span the vector [1, 0,..., 0]. 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 |
keys | A pointer to an initialized struct representing the keys for the decryption |
fame | A pointer to an initialized struct representing the scheme |