Topic: Confusion on wc_ecc_encrypt and wc_ecc_decrypt
Hello,
The documentation of wc_ecc_decrypt states it requires the following parameter:
pubKey pointer to the ecc_key object containing the public key of the peer with whom one wishes to communicate
I am providing this key however it seems its never used. Looking into the code of wc_ecc_decrypt I can see the public key is actually getting extracted from the message to decrypt itself:
if (ret == 0) {
ret = wc_ecc_init_ex(pubKey, privKey->heap, INVALID_DEVID);
}
if (ret == 0) {
ret = wc_ecc_import_x963_ex(msg, pubKeySz, pubKey, privKey->dp->id);
}
And within the wc_ecc_encrypt I can see the public key of the provided private key is actually prepended to the encrypted message.
So why are we even providing the peer's public key when its never used? The ecies sample seems also to use the peer's public key but as said according to the wc_ecc_encrypt / wc_ecc_decrypt code its never in use?
thanks for clarifications on this topic,
Alex