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

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)
 

Detailed Description

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 Documentation

◆ cfe_fame

typedef struct cfe_fame cfe_fame

cfe_fame represents the FAME scheme.

◆ 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.

◆ cfe_fame_sec_key

cfe_fame_sec_key represents the secret key for the FAME scheme.

◆ cfe_fame_cipher

cfe_fame_cipher represents the cipher for the FAME scheme.

◆ cfe_fame_attrib_keys

cfe_fame_attrib_keys represents the keys corresponding to attributes needed for the decryption.

Function Documentation

◆ cfe_fame_init()

void cfe_fame_init ( cfe_fame fame)

Configures a new instance of the scheme.

Parameters
fameA pointer to an uninitialized struct representing the scheme

◆ cfe_fame_free()

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.

Parameters
fameA pointer to an instance of the scheme (initialized cfe_fame struct)

◆ cfe_fame_sec_key_init()

void cfe_fame_sec_key_init ( cfe_fame_sec_key sk)

Initializes a secret key.

Parameters
skA pointer to an uninitialized struct representing the secret key

◆ cfe_fame_sec_key_free()

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.

Parameters
skA pointer to an instance of the secret key (initialized cfe_fame_sec_key struct)

◆ cfe_fame_generate_master_keys()

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.

Parameters
pkA 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
skA pointer to an initialized cfe_fame_sec_key struct, the secret key will be saved here
fameA pointer to an initialized struct representing the scheme

◆ cfe_fame_cipher_init()

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.

Parameters
cipherA pointer to an uninitialized struct representing the ciphertext
mspA pointer to an initialized struct representing the MSP policy

◆ cfe_fame_cipher_free()

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.

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

◆ cfe_fame_encrypt()

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.

Parameters
cipherA pointer to an initialized cfe_fame_cipher struct, the encryption will be saved here
msgAn element of FP12_BN254 representing the message
mspA pointer to an initialized struct representing the MSP policy
pkA pointer to an initialized struct representing the public key
fameA pointer to an initialized struct representing the scheme

◆ cfe_fame_attrib_keys_init()

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.

Parameters
keysA pointer to an uninitialized struct representing the keys
num_attribThe number of attributes that the keys will contain

◆ cfe_fame_attrib_keys_free()

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.

Parameters
keysA pointer to an instance of attribute keys (initialized cfe_fame_attrib_keys struct)

◆ cfe_fame_generate_attrib_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 
)

The function given an array of attributes and master secret keys creates keys corresponding to attributes that can be used for the decryption.

Parameters
keysA pointer to an initialized cfe_fame_attrib_keys struct, the keys for the decryption will be saved here
gammaAn array of attributes for which keys will be generated
num_attribLength of the array gamma, i.e. the number of attributes
skA pointer to a struct representing the secret keys
fameA pointer to an initialized struct representing the scheme

◆ cfe_fame_decrypt()

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.

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