Refactor OpenSSL code to a separate file