I want to implement ECDSA in OPENSSL. But I'm getting below warnings
ECDSA_sign deprecated & ECDSA_do_verify is deprecated.
Can anyone please guide me how to handle this error.
It seems that you are using the dev version of OpenSSL (what will become OpenSSL 3.0). Those functions are deprecated in dev but are not deprecated in the latest stable version (1.1.1).
The preferred method of doing signatures in OpenSSL (including with ECDSA) is to use the EVP_DigestSign*()
APIs.
The man pages for those functions are here:
https://www.openssl.org/docs/man1.1.1/man3/EVP_DigestSignInit.html
In order to use those you need to create an EVP_PKEY
object containing an ECDSA key. Typically this is done by creating an empty EVP_PKEY
using EVP_PKEY_new()
and then assigning an EC_KEY to it using EVP_PKEY_assign_EC_KEY
:
https://www.openssl.org/docs/man1.1.1/man3/EVP_PKEY_assign_EC_KEY.html
There is example code for signing and verifying using the EVP_DigestSign*()
APIs on the OpenSSL wiki here:
https://wiki.openssl.org/index.php/EVP_Signing_and_Verifying
Another alternative to using the EVP functions is to use the current stable version (1.1.1) where the functions you are attempting to use are not deprecated. But keep in mind that they will become deprecated when OpenSSL 3.0 is released.
A third alternative is to just ignore the deprecation warnings. The functions are still present and work. Assuming you haven't instructed the compiler to treat warnings as errors you should still be able to build your application. Keep in mind though that APIs flagged as deprecated may eventually be removed in some future version of OpenSSL.