Skip to content

Commit

Permalink
Add support for 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
zofer1 committed Aug 9, 2023
1 parent 065205e commit 935d0b7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/jwt-cpp/jwt.h
Original file line number Diff line number Diff line change
Expand Up @@ -868,13 +868,19 @@ namespace jwt {

std::unique_ptr<RSA, decltype(&RSA_free)> rsa(RSA_new(), RSA_free);

#if OPENSSL_VERSION_NUMBER >= 0x10100000L
//This is unlikely to fail, and after this call RSA_free will also free the n and e big numbers
if (RSA_set0_key(rsa.get(), n, e, nullptr) != 1){
ec = error::rsa_error::set_rsa_failed;
BN_free(e);
BN_free(n);
return {};
}
#else
rsa.get()->e = e;
rsa.get()->n = n;
rsa.get()->d = nullptr;
#endif

auto pubkeybio = make_mem_buf_bio();
if (!pubkeybio) {
Expand Down

0 comments on commit 935d0b7

Please sign in to comment.