MPHELL
5.0.0
|
Tutorial for ecsdsa signature and verification using mphell. More...
#include <stdio.h>
#include "mphell/mphell.h"
Go to the source code of this file.
Data Structures | |
struct | ecsdsa_sig |
Define an ECSDSA signature. More... | |
Typedefs | |
typedef struct ecsdsa_sig | ecsdsa_sig_t |
Define the ECSDSA signature type. | |
typedef ecsdsa_sig_t | ecsdsa_sig[1] |
Pointer on an allocated ecsdsa_sig_t structure. | |
Functions | |
void | ecsdsa_sign_alloc (ecsdsa_sig *sig, int size) |
void | ecsdsa_sign_free (ecsdsa_sig *sig) |
void | ec_point_mul_ecdsa (ec_point dst, number_srcptr u1, ec_point_srcptr G, number_srcptr u2, ec_point_srcptr key, ec_curve_srcptr E) |
void | ecsdsa_sign (unsigned char *hash, ecsdsa_sig *sig, number priv_key, ec_curve *curve) |
Sign "hash" with ECDSA algorithm using the EC "curve" and the private key "key". More... | |
int8_t | ecsdsa_verify (unsigned char *hash, ecsdsa_sig *sig, ec_point *pub_key, ec_curve *curve) |
Verify the signature "sig" of hash "hash" using public key "pub_key" and the EC "curve". More... | |
int8_t | ecsdsa_pub_key_validation (ec_point *pub_key, ec_curve *curve) |
Verify that the public key is valid (id est check taht pub_key belongs to the curve, that pub_key is not the neutral element and that pub_key is of ordre n) More... | |
int | main () |
Tutorial for ecsdsa signature and verification using mphell.
Definition in file mphell_tuto_ecsdsa.c.
Verify that the public key is valid (id est check taht pub_key belongs to the curve, that pub_key is not the neutral element and that pub_key is of ordre n)
hash | H(m) where H is a cryptographic hash function and m the message to sign. Must be written under hexadecimal form. ex: 64 hexadecimal characters for sha256. |
pub_key | Public key |
curve | Elliptic curve |
Definition at line 398 of file mphell_tuto_ecsdsa.c.
void ecsdsa_sign | ( | unsigned char * | hash, |
ecsdsa_sig * | sig, | ||
number | priv_key, | ||
ec_curve * | curve | ||
) |
Sign "hash" with ECDSA algorithm using the EC "curve" and the private key "key".
hash | H(m) where H is a cryptographic hash function and m the message to sign. Must be written under hexadecimal form. ex: 64 hexadecimal characters for sha256. |
sig | Destination signature. Pointer on an allocated ecdsa_sig structure. |
priv_key | Private key |
curve | Elliptic curve |
Definition at line 166 of file mphell_tuto_ecsdsa.c.
int8_t ecsdsa_verify | ( | unsigned char * | hash, |
ecsdsa_sig * | sig, | ||
ec_point * | pub_key, | ||
ec_curve * | curve | ||
) |
Verify the signature "sig" of hash "hash" using public key "pub_key" and the EC "curve".
For the hash several functions can be used, the interested reader can refer to [FIPS-180]
hash | H(m) where H is a cryptographic hash function and m the message to sign. Must be written under hexadecimal form. ex: 64 hexadecimal characters for sha256. |
sig | Signature of hash |
pub_key | Public key |
curve | Elliptic curve |
Definition at line 288 of file mphell_tuto_ecsdsa.c.