This function generates a signature from the data using a key. It first creates a hash of the data then signs the hash using the key.
int ret;
WC_RNG rng;
ecc_key eccKey;
sigBuf = malloc(sigLen);
WC_HASH_TYPE_SHA256, WC_SIGNATURE_TYPE_ECC,
fileBuf, fileLen,
sigBuf, &sigLen,
&eccKey, sizeof(eccKey),
&rng);
printf("Signature Generation: %s
(%d)\n", (ret == 0) ? "Pass" : "Fail", ret);
free(sigBuf);
int wc_ecc_make_key(WC_RNG *rng, int keysize, ecc_key *key)
This function generates a new ecc_key and stores it in key.
int wc_ecc_init(ecc_key *key)
This function initializes an ecc_key object for future use with message verification or key negotiati...
int wc_ecc_free(ecc_key *key)
This function frees an ecc_key object after it has been used.
int wc_InitRng(WC_RNG *)
Gets the seed (from OS) and key cipher for rng. rng->drbg (deterministic random bit generator) alloca...
int wc_FreeRng(WC_RNG *)
Should be called when RNG no longer needed in order to securely free drgb. Zeros and XFREEs rng-drbg.
int wc_SignatureGenerate(enum wc_HashType hash_type, enum wc_SignatureType sig_type, const byte *data, word32 data_len, byte *sig, word32 *sig_len, const void *key, word32 key_len, WC_RNG *rng)
This function generates a signature from the data using a key. It first creates a hash of the data th...
int wc_SignatureGetSize(enum wc_SignatureType sig_type, const void *key, word32 key_len)
This function returns the maximum size of the resulting signature.