| 98 | } |
| 99 | |
| 100 | void MySQLHandlerFactory::generateRSAKeys() |
| 101 | { |
| 102 | LOG_TRACE(log, "Generating new RSA key pair."); |
| 103 | public_key.reset(RSA_new()); |
| 104 | if (!public_key) |
| 105 | throw Exception("Failed to allocate RSA key. Error: " + getOpenSSLErrors(), ErrorCodes::OPENSSL_ERROR); |
| 106 | |
| 107 | BIGNUM * e = BN_new(); |
| 108 | if (!e) |
| 109 | throw Exception("Failed to allocate BIGNUM. Error: " + getOpenSSLErrors(), ErrorCodes::OPENSSL_ERROR); |
| 110 | SCOPE_EXIT(BN_free(e)); |
| 111 | |
| 112 | if (!BN_set_word(e, 65537) || !RSA_generate_key_ex(public_key.get(), 2048, e, nullptr)) |
| 113 | throw Exception("Failed to generate RSA key. Error: " + getOpenSSLErrors(), ErrorCodes::OPENSSL_ERROR); |
| 114 | |
| 115 | private_key.reset(RSAPrivateKey_dup(public_key.get())); |
| 116 | if (!private_key) |
| 117 | throw Exception("Failed to copy RSA key. Error: " + getOpenSSLErrors(), ErrorCodes::OPENSSL_ERROR); |
| 118 | } |
| 119 | #endif |
| 120 | |
| 121 | Poco::Net::TCPServerConnection * MySQLHandlerFactory::createConnection(const Poco::Net::StreamSocket & socket, TCPServer & tcp_server) |
nothing calls this directly
no test coverage detected