Search code examples
sslopensslboost-asio

TLS 1.2 set cipher list


I would like to set the TLS 1.2 configuration as below in my linux application.

ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

I know of the API SSL_CTX_set_cipher_list(SSL *ssl, const char *str); My question is how do I set more than one cipher using this API. Should I call this API twice or how else?

Currently I am setting only one configuration like this:

SSL_CTX_set_cipher_list(ctx, ECDHE-RSA-AES256-GCM-SHA384)

How do I set both the configurations as listed above?


Solution

  • Based on https://www.openssl.org/docs/man1.0.2/man1/ciphers.html "The cipher list consists of one or more cipher strings separated by colons. Commas or spaces are also acceptable separators but colons are normally used."

    I would say 'ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:ECDHE_ECDSA_WITH_AES_128_GCM_SHA256'