diff --git a/libs/cryptoplus/src/rsa_key.cpp b/libs/cryptoplus/src/rsa_key.cpp index d5aecc1c..cbe342af 100644 --- a/libs/cryptoplus/src/rsa_key.cpp +++ b/libs/cryptoplus/src/rsa_key.cpp @@ -65,23 +65,22 @@ namespace cryptoplus rsa_key rsa_key::generate_private_key(int num, unsigned long exponent, generate_callback_type callback, void* callback_arg, bool must_take_ownership) { - static_cast(num); - static_cast(exponent); - static_cast(callback); - static_cast(callback_arg); + static_cast(callback); + static_cast(callback_arg); + + std::unique_ptr bn(BN_new(), ::BN_free); + BN_set_word(bn.get(), exponent); - std::unique_ptr bn(BN_new(), ::BN_free); - RSA* ptr = nullptr; rsa_key key = rsa_key::create(); - RSA_generate_key_ex(key.raw(), 2048, bn.get(), NULL); + RSA_generate_key_ex(key.raw(), num, bn.get(), NULL); if (must_take_ownership) { - return take_ownership(ptr); + return key; } else { - return ptr; + return nullptr; } }