Improved ID-based Proxy Signature Scheme with Message Recovery
Improved version provided by Caixue Zhou of the Singh and Verma’s proxy signature scheme with message recovery.
Loading...
Searching...
No Matches
data.h File Reference

Header file containing the data structures used by the scheme and the functions used to manage them. More...

#include <string.h>
#include <pbc/pbc.h>
#include "define.h"

Go to the source code of this file.

Data Structures

struct  sv_public_params_struct
 
struct  sv_secret_params_struct
 
struct  sv_user_struct
 
struct  warrant_struct
 
struct  delegation_struct
 
struct  proxy_signature_struct
 

Macros

#define IDENTITY_SIZE   32
 
#define WARRANT_SIZE   64
 
#define MAX_DIGEST_SIZE   64
 
#define MAX_PARAM_LINE_SIZE   4096
 
#define generic_dlog_secure_size_by_security_level(level)   ((level)*2)
 
#define STR_IDENTITY_SIZE(string)   strlen(string) > IDENTITY_SIZE ? IDENTITY_SIZE : strlen(string)
 

Typedefs

typedef uint8_t sv_identity_t[IDENTITY_SIZE]
 
typedef uint8_t serialized_warrant_t[WARRANT_SIZE]
 
typedef struct sv_public_params_structsv_public_params_ptr
 
typedef struct sv_public_params_struct sv_public_params_t[1]
 
typedef struct sv_secret_params_structsv_secret_params_ptr
 
typedef struct sv_secret_params_struct sv_secret_params_t[1]
 
typedef struct sv_user_structsv_user_ptr
 
typedef struct sv_user_struct sv_user_t[1]
 
typedef struct warrant_structwarrant_ptr
 
typedef struct warrant_struct warrant_t[1]
 
typedef struct delegation_structdelegation_ptr
 
typedef struct delegation_struct delegation_t[1]
 
typedef struct proxy_signature_structproxy_signature_ptr
 
typedef struct proxy_signature_struct proxy_signature_t[1]
 

Enumerations

enum  hash_type_t { sha_1 , sha_256 , sha_512 }
 

Functions

long read_binary_file (uint8_t **data, const char file_path[])
 
void user_init (sv_user_t user, const sv_identity_t identity, sv_public_params_t public_p)
 Initialize the user struct. Make sure all elements are initialized. Both the secret and public keys are set to 0, so it is easy to check if they have been extracted. More...
 
void user_init_str (sv_user_t user, const char identity[], sv_public_params_t public_p)
 Initialize the user struct using a string as identity. Make sure all elements are initialized. Both the secret and public keys are set to 0, so it is easy to check if they have been extracted. More...
 
void delegation_init (delegation_t w, sv_public_params_t public_p)
 Initialize the warrant struct. Make sure all elements are initialized. More...
 
void proxy_signature_init (proxy_signature_t p_sig, sv_public_params_t public_p)
 Initialize the proxy signature struct. Make sure all elements are initialized. More...
 
uint16_t serialize_warrant (uint8_t buffer[WARRANT_SIZE], const warrant_t m)
 Serialize a warrant structure converting it into a byte array. This allows for easy hashing and storage of the warrant. More...
 
uint16_t deserialize_warrant (warrant_t m, const uint8_t buffer[WARRANT_SIZE])
 Deserialize a warrant structure converting it from a byte array to a warrant structure. More...
 
int serialize_delegation (uint8_t **data, delegation_t w)
 Serialize the delegation structure converting it into a byte array. The buffer is allocated inside the function and must be freed by the caller. More...
 
void deserialize_delegation (delegation_t w, uint8_t data[])
 Read a serialized delegation from a buffer and deserialize it, obtaining a delegation structure. More...
 
void deserialize_delegation_from_file (delegation_t w, const char file_path[])
 Read a serialized delegation from a file and deserialize it, obtaining a delegation structure. More...
 
void delegation_printf (delegation_t w)
 Print the delegation structure to stdout in binary format. More...
 
void delegation_fprintf (FILE *stream, delegation_t w)
 Print the delegation structure to the provided stream in binary format. More...
 
int serialize_proxy_signature (uint8_t **data, proxy_signature_t p_sign)
 Serialize the proxy signature structure converting it into a byte array. The buffer is allocated inside the function and must be freed by the caller. More...
 
void deserialize_proxy_signature (proxy_signature_t p_sign, uint8_t data[])
 Read a serialized proxy signature from a buffer and deserialize it, obtaining a proxy signature structure. More...
 
void deserialize_proxy_signature_from_file (proxy_signature_t p_sig, const char file_path[])
 Read a serialized proxy signature from a file and deserialize it, obtaining a proxy signature structure. More...
 
void proxy_signature_printf (proxy_signature_t p_sign)
 Print the proxy signature structure to stdout in binary format. More...
 
void proxy_signature_fprintf (FILE *stream, proxy_signature_t p_sign)
 Print the proxy signature structure to the provided stream in binary format. More...
 
void public_param_clear (sv_public_params_t public_p)
 Clear the public param struct. Makes sure all elements are cleared. More...
 
void secret_param_clear (sv_secret_params_t secret_p)
 Clear the secret param struct. Make sure all elements are cleared. More...
 
void user_clear (sv_user_t user)
 Clear the user struct. Make sure all elements are cleared. More...
 
void delegation_clear (delegation_t w)
 Clear the warrant struct. Make sure all elements are cleared. More...
 
void proxy_signature_clear (proxy_signature_t p_sig)
 Clear the proxy signature struct. Make sure all elements are cleared. More...
 

Detailed Description

Header file containing the data structures used by the scheme and the functions used to manage them.

Author
TendTo (https://github.com/TendTo)

Function Documentation

◆ delegation_clear()

void delegation_clear ( delegation_t  w)

Clear the warrant struct. Make sure all elements are cleared.

Parameters
wWarrant to be cleared.

◆ delegation_fprintf()

void delegation_fprintf ( FILE *  stream,
delegation_t  w 
)

Print the delegation structure to the provided stream in binary format.

Parameters
streamfile stream where to print the delegation structure.
wdelegation structure to be printed.

◆ delegation_init()

void delegation_init ( delegation_t  w,
sv_public_params_t  public_p 
)

Initialize the warrant struct. Make sure all elements are initialized.

Parameters
wWarrant to be initialized.
public_pPublic parameters of the scheme.

◆ delegation_printf()

void delegation_printf ( delegation_t  w)

Print the delegation structure to stdout in binary format.

Parameters
wdelegation structure to be printed.

◆ deserialize_delegation()

void deserialize_delegation ( delegation_t  w,
uint8_t  data[] 
)

Read a serialized delegation from a buffer and deserialize it, obtaining a delegation structure.

Parameters
wdelegation structure read from the buffer.
databuffer containing the serialized delegation.

◆ deserialize_delegation_from_file()

void deserialize_delegation_from_file ( delegation_t  w,
const char  file_path[] 
)

Read a serialized delegation from a file and deserialize it, obtaining a delegation structure.

Parameters
wdelegation structure read from the file.
file_pathpath to the file containing the serialized delegation.

◆ deserialize_proxy_signature()

void deserialize_proxy_signature ( proxy_signature_t  p_sign,
uint8_t  data[] 
)

Read a serialized proxy signature from a buffer and deserialize it, obtaining a proxy signature structure.

Parameters
p_signproxy signature structure read from the buffer.
databuffer containing the serialized proxy signature.

◆ deserialize_proxy_signature_from_file()

void deserialize_proxy_signature_from_file ( proxy_signature_t  p_sig,
const char  file_path[] 
)

Read a serialized proxy signature from a file and deserialize it, obtaining a proxy signature structure.

Parameters
p_sigproxy signature structure read from the file.
file_pathpath to the file containing the serialized proxy signature.

◆ deserialize_warrant()

uint16_t deserialize_warrant ( warrant_t  m,
const uint8_t  buffer[WARRANT_SIZE] 
)

Deserialize a warrant structure converting it from a byte array to a warrant structure.

Parameters
mwarrant structure to be serialized.
bufferbuffer to store the serialized warrant.
Returns
uint16_t size of the serialized warrant.

◆ proxy_signature_clear()

void proxy_signature_clear ( proxy_signature_t  p_sig)

Clear the proxy signature struct. Make sure all elements are cleared.

Parameters
p_sigProxy signature to be cleared.

◆ proxy_signature_fprintf()

void proxy_signature_fprintf ( FILE *  stream,
proxy_signature_t  p_sign 
)

Print the proxy signature structure to the provided stream in binary format.

Parameters
streamfile stream where to print the proxy signature structure.
p_signproxy signature structure to be printed.

◆ proxy_signature_init()

void proxy_signature_init ( proxy_signature_t  p_sig,
sv_public_params_t  public_p 
)

Initialize the proxy signature struct. Make sure all elements are initialized.

Parameters
p_sigProxy signature to be initialized.
public_pPublic parameters of the scheme.

◆ proxy_signature_printf()

void proxy_signature_printf ( proxy_signature_t  p_sign)

Print the proxy signature structure to stdout in binary format.

Parameters
p_signproxy signature structure to be printed.

◆ public_param_clear()

void public_param_clear ( sv_public_params_t  public_p)

Clear the public param struct. Makes sure all elements are cleared.

Parameters
public_pPublic parameters of the scheme to be cleared.

◆ secret_param_clear()

void secret_param_clear ( sv_secret_params_t  secret_p)

Clear the secret param struct. Make sure all elements are cleared.

Parameters
secret_pSecret parameters of the scheme to be cleared.

◆ serialize_delegation()

int serialize_delegation ( uint8_t **  data,
delegation_t  w 
)

Serialize the delegation structure converting it into a byte array. The buffer is allocated inside the function and must be freed by the caller.

Parameters
datanewly allocated buffer containing the serialized delegation.
wdelegation structure to be serialized.
Returns
length of the serialized delegation.

◆ serialize_proxy_signature()

int serialize_proxy_signature ( uint8_t **  data,
proxy_signature_t  p_sign 
)

Serialize the proxy signature structure converting it into a byte array. The buffer is allocated inside the function and must be freed by the caller.

Parameters
databuffer to store the serialized proxy signature.
p_signproxy signature structure to be serialized.
Returns
length of the serialized proxy signature.

◆ serialize_warrant()

uint16_t serialize_warrant ( uint8_t  buffer[WARRANT_SIZE],
const warrant_t  m 
)

Serialize a warrant structure converting it into a byte array. This allows for easy hashing and storage of the warrant.

Parameters
bufferbuffer to store the serialized warrant. It must be at least IDENTITY_SIZE * 2 bytes long.
mwarrant structure to be serialized.
Returns
uint16_t size of the serialized warrant.

◆ user_clear()

void user_clear ( sv_user_t  user)

Clear the user struct. Make sure all elements are cleared.

Parameters
userUser to be cleared.

◆ user_init()

void user_init ( sv_user_t  user,
const sv_identity_t  identity,
sv_public_params_t  public_p 
)

Initialize the user struct. Make sure all elements are initialized. Both the secret and public keys are set to 0, so it is easy to check if they have been extracted.

Parameters
userUser to be initialized.
identityIdentity of the user.
public_pPublic parameters of the scheme.

◆ user_init_str()

void user_init_str ( sv_user_t  user,
const char  identity[],
sv_public_params_t  public_p 
)

Initialize the user struct using a string as identity. Make sure all elements are initialized. Both the secret and public keys are set to 0, so it is easy to check if they have been extracted.

Parameters
userUser to be initialized.
identityIdentity of the user represented as a string.
public_pPublic parameters of the scheme.