Toychain!
A toy blockchain in C
|
header of sign.c More...
Go to the source code of this file.
Data Structures | |
struct | _Signature |
struct | _Protected |
Typedefs | |
typedef struct _Signature | Signature |
typedef struct _Protected | Protected |
Functions | |
Signature * | init_signature_raw (int64 *content, int size) |
initialize a signaure without copying the data !!! takes ownership of content More... | |
Signature * | init_signature (const int64 *content, int size) |
initialize a signaure More... | |
Signature * | copy_signature (const Signature *o) |
Copy a Signature object. More... | |
void | free_signature (Signature *sig) |
free a Signature object. More... | |
Signature * | sign (char *mess, Key *sKey) |
sign a message More... | |
char * | signature_to_str (const Signature *sgn) |
convert a signature to string More... | |
Signature * | str_to_signature (const char *str) |
parse a string to a signature More... | |
Signature * | str_to_signature_len (const char *str, size_t len) |
Converts a string to a signature, knowing it's length. More... | |
Protected * | init_protected (Key *pKey, char *mess, Signature *sgn) |
create a signed declaration More... | |
Protected * | init_protected_raw (Key *pKey, char *mess, Signature *sgn) |
create a signed declaration !!! Takes ownership of key, message and signature. More... | |
void | free_protected (Protected *pr) |
free a signed declaration and it's content More... | |
Protected * | copy_protected (const Protected *o) |
copy protected More... | |
bool | verify (const Protected *pr) |
checks if the signature matches the message More... | |
char * | protected_to_str (const Protected *prc) |
convert a signed Protected (declaration) to string. More... | |
Protected * | str_to_protected (const char *str) |
parse a string to a signed declaration More... | |
Protected * | str_to_protected_len (const char *str, size_t slen) |
parse a string to a signed declaration More... | |
header of sign.c
typedef struct _Protected Protected |
Structure for storing a Protected (declaration).
typedef struct _Signature Signature |
A struct for storing a signature
copy protected
o | Protected to copy |
Copy a Signature object.
o |
void free_protected | ( | Protected * | pr | ) |
free a signed declaration and it's content
pr | : element to free |
void free_signature | ( | Signature * | sig | ) |
free a Signature object.
sig | : signature to delete |
create a signed declaration
pKey | : public key |
mess | : associated message |
sgn | : signed message |
create a signed declaration !!! Takes ownership of key, message and signature.
pKey | : public key |
mess | : associated message |
sgn | : signed message |
initialize a signaure
content | : content of the signature |
size | : size of content |
initialize a signaure without copying the data !!! takes ownership of content
content | : content of the signature |
size | : size of content |
char * protected_to_str | ( | const Protected * | prc | ) |
convert a signed Protected (declaration) to string.
prc | : declaration to convert |
sign a message
mess | : message to sign |
sKey | : private key to sign the message with |
char * signature_to_str | ( | const Signature * | sgn | ) |
convert a signature to string
sgn | : signature to convert |
Protected * str_to_protected | ( | const char * | str | ) |
parse a string to a signed declaration
str | : string to parse |
Protected * str_to_protected_len | ( | const char * | str, |
size_t | slen | ||
) |
parse a string to a signed declaration
str | : string to parse |
slen | : length of the string |
Signature * str_to_signature | ( | const char * | str | ) |
parse a string to a signature
str |
Signature * str_to_signature_len | ( | const char * | str, |
const size_t | len | ||
) |
Converts a string to a signature, knowing it's length.
str | |
len |
bool verify | ( | const Protected * | pr | ) |
checks if the signature matches the message
Protected* | : protected message |