Thalhammer / jwt-cpp

A header only library for creating and validating json web tokens in c++
https://thalhammer.github.io/jwt-cpp/
MIT License
865 stars 235 forks source link

How to solve "‘RSA_padding_add_PKCS1_PSS_mgf1’ was not declared in this scope" error? #187

Closed carlosalbertos closed 2 years ago

carlosalbertos commented 2 years ago

Hello. I'm getting the error message below when compiling an C++ app with jwt.h on Ubuntu 20.04. ‘RSA_padding_add_PKCS1_PSS_mgf1’ was not declared in this scope; did you mean ‘RSA_padding_add_PKCS1_PSS’ The following libraries are being linked in the project: pthread curl crypto ssl crypto xml2 dl z What is the source of the error and how to solve it?

kleinmrk commented 2 years ago

Seems like the version of libcrypto you use does not export RSA_padding_add_PKCS1_PSS_mgf1.

The usage of RSA_padding_add_PKCS1_PSS_mgf1 has been replaced by RSA_padding_add_PKCS1_PSS in the master branch by this PR.

prince-chrismc commented 2 years ago

What version of jwt-cpp are you using? What "crypto" library are you using? Which example/documentation did you follow? What compiler are you using?

Assuming OpenSSL, that function has been there for 12years with 1.1.0.

https://github.com/openssl/openssl/commit/e8254d406fb90282a7afef5d7def0aef1efe96aa

carlosalbertos commented 2 years ago

Sorry, it was my mistake. There was a folder containing pre 1.0.0 OpenSSL headers in the project tree, and this was causing the problem. Just remove the folder and the build was successful. Thanks for the quick response.

Thalhammer commented 2 years ago

Glad to see you got it sorted out. Let us know if you experience any other issues ;)