mysql_get_ssl_cipher(3)

πŸ“¦
version 13.0.2 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– mysql_get_ssl_cipher(3) πŸ’–

okay bestie, so this one lives in the MariaDB Connector/C manual, and it's genuinely one of the cutest little functions ever β€” it just tells you what cipher suite your secure connection is vibing with rn. no cap. πŸŽ€


✨ Name ✨

mysql_get_ssl_cipher β€” returns the cipher suite in use πŸ”


🌸 Synopsis 🌸

#include <mysql.h>

const char *mysql_get_ssl_cipher(MYSQL *mysql)

πŸ¦‹ Description πŸ¦‹

It returns the name of the currently used cipher suite of the secure connection, or NULL for non TLS connections. that's it. that's the whole function. iconic behaviour honestly πŸ’…


πŸ“ Parameter πŸ“

  • mysql β€” a connection identifier, which was previously allocated by mysql_init(3) and connected by mysql_real_connect(3). like, you can't just hand it a random pointer bestie, it needs to be a real live connection that actually went through the whole init-then-connect pipeline first 🫢

πŸ’œ Notes πŸ’œ

  • For using mysql_get_ssl_cipher() MariaDB Connector/C must be built with TLS/SSL support, otherwise the function will return NULL. so if your build skipped the TLS glow-up, this function is just gonna shrug at you πŸ™ˆ
  • mysql_get_ssl_cipher() can be used to determine if the client server connection is secure. vibe check your connection, basically ✨
  • Depending on the TLS library in use (OpenSSL, GnuTLS or Windows Schannel) the name of the cipher suites may differ. For example the cipher suite 0x002F (TLS_RSA_WITH_AES_128_CBC_SHA) has different names: AES128-SHA for OpenSSL and Schannel and TLS_RSA_AES_128_CBC_SHA1 for GnuTLS. same cipher, three different names, it's giving "same girl different username on every app" 😭 so don't be shocked when the string doesn't match what you expected β€” check which library you're running first.

πŸ‘‘ Return value πŸ‘‘

Returns a zero terminated string containing the cipher suite used for a secure connection, or NULL if connection doesn't use TLS/SSL. so: string = slay, NULL = no encryption happening here, periodt πŸ’€


🌈 See also 🌈


heads up bestie: if you get NULL back it doesn't automatically mean something broke β€” it can just mean the connection isn't using TLS/SSL at all, or that the library was built without TLS/SSL support. two very different reasons, same sad little NULL πŸ₯²

Version 3.4 β€” mysql_get_ssl_cipher(3), mwah, that's a wrap, tysm for reading my little manpage essay, go check your cipher suites and stay encrypted out there πŸ’–βœ¨πŸ”πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from