---
name: "mysql_get_ssl_cipher"
section: "3"
platform: "linux"
package: "mariadb"
version: "13.0.2-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/mysql_get_ssl_cipher"
---

# mysql\_get\_ssl\_cipher(3)

### Name

mysql\_get\_ssl\_cipher - returns the cipher suite in use

### Synopsis

-

  ```
  #include <mysql.h>
  const char *mysql_get_ssl_cipher(MYSQL *mysql)
  ```

### Description

Returns the name of the currently used cipher suite of the secure connection, or NULL for non TLS connections.

### Parameter

- •

  `mysql` - a connection identifier, which was previously allocated by **[mysql\_init(3)](/mysql_init/3.md)** and connected by **[mysql\_real\_connect(3)](/mysql_real_connect/3.md)**.

### Notes

- •

  For using `mysql_get_ssl_cipher()` MariaDB Connector/C must be built with TLS/SSL support, otherwise the function will return NULL.

- •

  \`mysql\_get\_ssl\_cipher()’ can be used to determine if the client server connection is secure.

- •

  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.

### 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.

### See also

- •

  **[mysql\_ssl\_set(3)](/mysql_ssl_set/3.md)**
