Closed quanchentg closed 9 months ago
What version of jwt-cpp are you using?
0.6.0 thanks for your reply @prince-chrismc
🤔 hmm are you sure about that version of openssl is the one being pulled into your build scripts and being linked against?
I've not used devtoolset-9
but perhaps it has a never version? You could run scl enable devtoolset-9 "openssl --version"
to check.
I wanted to double check the docs but I am only getting a 404 https://www.openssl.org/docs/man1.0.2/man3/EVP_MD_CTX_destroy.html
This should be the correct logic, in 1.1.0 they changed everything to free https://github.com/Thalhammer/jwt-cpp/blob/ce1f9df3a9f861d136d6f0c93a6f811c364d1d3d/include/jwt-cpp/jwt.h#L486
You can check the CI but we compile from source and test each one
i used the command scl enable devtoolset-9 "openssl --version" it returns OpenSSL 1.0.2k-fips 26 Jan 2017.
more info if i use auto verify = jwt::verify().allow_algorithm(jwt::algorithm::hs512{jwt_secret}).with_issuer("auth0"); in my project, it compiles OK. but i add the other verify = jwt::verify().allow_algorithm(jwt::algorithm::rs256(private_key, "", "", "")) .with_issuer("auth0"); in my project, then it returns undefined reference error by compiler.
I think it may related to rs256 algorighm?
Can you comment out the library code and print OPENSSL_VERSION_TEXT
https://www.openssl.org/docs/manmaster/man3/OPENSSL_VERSION_NUMBER.html
How are you linking to OpenSSL? What build system are you using?
I think it may related to rs256 algorighm?
Yes the cryptographic keys use the evp context, the hmac is very basic (and insecure) so it doesn't use APIs that have changed
seems like i use openssl 1.1.0 version for linker but i have another openssl 1.0.2 version installed on my machine.
I highly recommend using a package manager to manage 3rd party dependencies.
Unfortunately there is jot much I can , I will mark this as closed. Bestnof luck!
What's your question?
undefined reference error in compiling
Additional Context
I used centoOS 7 and openssl version is OpenSSL 1.0.2k-fips 26 Jan 2017. get error while compiling /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: librestpp_lib.a(auth.cpp.o): in function
jwt::algorithm::rsa::verify(std::string const&, std::string const&, std::error_code&) const': *****/jwt-cpp/jwt.h:957: undefined reference to
EVP_MD_CTX_destroy' /opt/rh/devtoolset-9/root/usr/libexec/gcc/x86_64-redhat-linux/9/ld: *****/jwt/jwt-cpp/jwt.h:957: undefined reference to `EVP_MD_CTX_create' collect2: error: ld returned 1 exit status