# CassSsl

### struct CassSsl

Describes the SSL configuration of a cluster. 

### Public Types

### enum CassSslVerifyFlags

*Values:*

### Public Functions

### [CassSsl](#_CPPv47CassSsl) \*cass_ssl_new()

Creates a new SSL context.

#### SEE ALSO
[cass_ssl_free()](#struct_cass_ssl_1a807650aac5e1aacc55d266b3391d657c)

* **Returns:**
  Returns a SSL context that must be freed.

### [CassSsl](#_CPPv47CassSsl) \*cass_ssl_new_no_lib_init()

Creates a new SSL context **without** initializing the underlying library implementation. The integrating application is responsible for initializing the underlying SSL implementation. The driver uses the SSL implmentation from several threads concurrently so it’s important that it’s properly setup for multithreaded use e.g. lock callbacks for OpenSSL.

**Important:** The SSL library must be initialized before calling this function.

When using OpenSSL the following components need to be initialized:

SSL_library_init(); SSL_load_error_strings(); OpenSSL_add_all_algorithms();

The following thread-safety callbacks also need to be set:

CRYPTO_set_locking_callback(…); CRYPTO_set_id_callback(…);

#### SEE ALSO
[cass_ssl_new()](#struct_cass_ssl_1a25340df889e674a5e2ad1b60e6dcc4e4)

#### SEE ALSO
[cass_ssl_free()](#struct_cass_ssl_1a807650aac5e1aacc55d266b3391d657c)

* **Returns:**
  Returns a SSL context that must be freed.

### void cass_ssl_free([CassSsl](#_CPPv47CassSsl) \*ssl)

Frees a SSL context instance.

* **Parameters:**
  **ssl** – **[in]** 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.0.1/api/group.CassError.md#_CPPv49CassError) cass_ssl_add_trusted_cert([CassSsl](#_CPPv47CassSsl) \*ssl, const char \*cert)

Adds a trusted certificate. This is used to verify the peer’s certificate.

* **Parameters:**
  * **ssl** – **[in]** 
  * **cert** – **[in]** PEM formatted certificate string 
* **Returns:**
  CASS_OK if successful, otherwise an error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.0.1/api/group.CassError.md#_CPPv49CassError) cass_ssl_add_trusted_cert_n([CassSsl](#_CPPv47CassSsl) \*ssl, const char \*cert, size_t cert_length)

Same as [cass_ssl_add_trusted_cert()](#struct_cass_ssl_1a7d23d54e58ebdc88d6376259cc140ae8), but with lengths for string parameters.

#### SEE ALSO
[cass_ssl_add_trusted_cert()](#struct_cass_ssl_1a7d23d54e58ebdc88d6376259cc140ae8)

* **Parameters:**
  * **ssl** – **[in]** 
  * **cert** – **[in]** 
  * **cert_length** – **[in]** 
* **Returns:**
  same as [cass_ssl_add_trusted_cert()](#struct_cass_ssl_1a7d23d54e58ebdc88d6376259cc140ae8)

### void cass_ssl_set_verify_flags([CassSsl](#_CPPv47CassSsl) \*ssl, int flags)

Sets verification performed on the peer’s certificate.

CASS_SSL_VERIFY_NONE - No verification is performed CASS_SSL_VERIFY_PEER_CERT - Certificate is present and valid CASS_SSL_VERIFY_PEER_IDENTITY - IP address matches the certificate’s common name or one of its subject alternative names. This implies the certificate is also present. CASS_SSL_VERIFY_PEER_IDENTITY_DNS - Hostname matches the certificate’s common name or one of its subject alternative names. This implies the certificate is also present. Hostname resolution must also be enabled.

**Default:** CASS_SSL_VERIFY_PEER_CERT

#### SEE ALSO
cass_cluster_set_use_hostname_resolution() 

* **Parameters:**
  * **ssl** – **[in]** 
  * **flags** – 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.0.1/api/group.CassError.md#_CPPv49CassError) cass_ssl_set_cert([CassSsl](#_CPPv47CassSsl) \*ssl, const char \*cert)

Set client-side certificate chain. This is used to authenticate the client on the server-side. This should contain the entire Certificate chain starting with the certificate itself.

* **Parameters:**
  * **ssl** – **[in]** 
  * **cert** – **[in]** PEM formatted certificate string 
* **Returns:**
  CASS_OK if successful, otherwise an error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.0.1/api/group.CassError.md#_CPPv49CassError) cass_ssl_set_cert_n([CassSsl](#_CPPv47CassSsl) \*ssl, const char \*cert, size_t cert_length)

Same as [cass_ssl_set_cert()](#struct_cass_ssl_1a69837ecccf2f65de504d28f188025dea), but with lengths for string parameters.

#### SEE ALSO
[cass_ssl_set_cert()](#struct_cass_ssl_1a69837ecccf2f65de504d28f188025dea)

* **Parameters:**
  * **ssl** – **[in]** 
  * **cert** – **[in]** 
  * **cert_length** – **[in]** 
* **Returns:**
  same as [cass_ssl_set_cert()](#struct_cass_ssl_1a69837ecccf2f65de504d28f188025dea)

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.0.1/api/group.CassError.md#_CPPv49CassError) cass_ssl_set_private_key([CassSsl](#_CPPv47CassSsl) \*ssl, const char \*key, const char \*password)

Set client-side private key. This is used to authenticate the client on the server-side.

* **Parameters:**
  * **ssl** – **[in]** 
  * **key** – **[in]** PEM formatted key string 
  * **password** – **[in]** used to decrypt key 
* **Returns:**
  CASS_OK if successful, otherwise an error occurred 

### [CassError](https://cpp-rs-driver.docs.scylladb.com/v1.0.1/api/group.CassError.md#_CPPv49CassError) cass_ssl_set_private_key_n([CassSsl](#_CPPv47CassSsl) \*ssl, const char \*key, size_t key_length, const char \*password, size_t password_length)

Same as [cass_ssl_set_private_key()](#struct_cass_ssl_1a5822e6745fab04de468d01f4aa19adb3), but with lengths for string parameters.

#### SEE ALSO
[cass_ssl_set_private_key()](#struct_cass_ssl_1a5822e6745fab04de468d01f4aa19adb3)

* **Parameters:**
  * **ssl** – **[in]** 
  * **key** – **[in]** 
  * **key_length** – **[in]** 
  * **password** – **[in]** 
  * **password_length** – **[in]** 
* **Returns:**
  same as [cass_ssl_set_private_key()](#struct_cass_ssl_1a5822e6745fab04de468d01f4aa19adb3)
