# mysql\_get\_ssl\_cipher

## Syntax

```c
const char *mysql_get_ssl_cipher(MYSQL *mysql)
```

## Parameter

* `mysql` - a mysql handle, which was previously allocated by [mysql\_init()](/docs/connectors/mariadb-connector-c/api-functions/mysql_init.md) or [mysql\_real\_connect()](/docs/connectors/mariadb-connector-c/api-functions/mysql_real_connect.md).

## Description

Returns the name of the currently used cipher of the [TLS connection](/docs/server/security/encryption/data-in-transit-encryption/secure-connections-overview.md), or NULL for non TLS connections.

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

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

## See Also

* [mysql\_ssl\_set()](/docs/connectors/mariadb-connector-c/api-functions/mysql_ssl_set.md)

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_get_ssl_cipher.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
