Refactor getting the cert
Use OpenSSL library instead of the non-portable cmdline