设置 cipher suite

https://man.openbsd.org/SSL_CTX_set_cipher_list.3#ECDHE

SSL_CTX_set_cipher_list() sets the list of available cipher suites for ctx using the control string. The list of cipher suites is inherited by all ssl objects created from ctx.

SSL_set_cipher_list() sets the list of cipher suites only for ssl.

The control string consists of one or more control words separated by colon characters (‘:’). Space (‘ ’), semicolon (‘;’), and comma (‘,’) characters can also be used as separators. Each control words selects a set of cipher suites and can take one of the following optional prefix characters:

No prefix:
Those of the selected cipher suites that have not been made available yet are added to the end of the list of available cipher suites, preserving their order.
Prefixed minus sign (‘-’):
Those of the selected cipher suites that have been made available earlier are moved back from the list of available cipher suites to the beginning of the list of unavailable cipher suites, also preserving their order.
Prefixed plus sign (‘+’):
Those of the selected cipher suites have been made available earlier are moved to end of the list of available cipher suites, reducing their priority, but preserving the order among themselves.
Prefixed exclamation mark (‘!’):
The selected cipher suites are permanently deleted, no matter whether they had earlier been made available or not, and can no longer be added or re-added by later words.

The following special words can only be used without a prefix:

An alias for ALL:!aNULL:!eNULL. It can only be used as the first word.
Sort the list by decreasing encryption strength, preserving the order of cipher suites that have the same strength. It is usally given as the last word.

The following words can be used to select groups of cipher suites, with or without a prefix character. If two or more of these words are joined with plus signs (‘+’) to form a longer word, only the intersection of the specified sets is selected.

Cipher suites using ephemeral DH for key exchange without doing any server authentication. Equivalent to kEDH+aNULL.
Cipher suites using DSS server authentication. LibreSSL does not provide any such cipher suites.
Cipher suites using Authenticated Encryption with Additional Data.
Cipher suites using ephemeral ECDH for key exchange without doing any server authentication. Equivalent to kEECDH+aNULL.
Cipher suites using ECDSA server authentication.
Cipher suites using AES or AESGCM for symmetric encryption.
Cipher suites using AES(128) or AESGCM(128) for symmetric encryption.
Cipher suites using AES(256) or AESGCM(256) for symmetric encryption.
Cipher suites using AESGCM for symmetric encryption.
An alias for aGOST01.
Cipher suites using GOST R 34.10-2001 server authentication.
All cipher suites except those selected by eNULL.
Cipher suites that don't do any server authentication. Not enabled by DEFAULT. Beware of man-in-the-middle attacks.
Cipher suites using RSA server authentication.
Cipher suites using Camellia for symmetric encryption.
Cipher suites using Camellia(128) for symmetric encryption.
Cipher suites using Camellia(256) for symmetric encryption.
Cipher suites using ChaCha20-Poly1305 for symmetric encryption.
Cipher suites that are not included in ALL. Currently an alias for eNULL.
Cipher suites that are included in ALL, but not included in DEFAULT. Currently similar to aNULL:!eNULL except for the order of the cipher suites which are not selected.
Cipher suites using single DES for symmetric encryption.
Cipher suites using triple DES for symmetric encryption.
An alias for kEDH.
Cipher suites using ephemeral DH for key exchange, but excluding those that don't do any server authentication. Similar to kEDH:!aNULL except for the order of the cipher suites which are not selected.
An alias for aDSS.
An alias for kEECHD.
Cipher suites using ephemeral ECDH for key exchange, but excluding those that don't do any server authentication. Similar to kEECDH:!aNULL except for the order of the cipher suites which are not selected.
An alias for aECDSA.
An alias for DHE.
An alias for ECDHE.
Cipher suites that do not use any encryption. Not enabled by DEFAULT, and not even included in ALL.
Cipher suites using GOST 28147-89 for message authentication instead of HMAC.
Cipher suites using HMAC based on GOST R 34.11-94 for message authentication.
Cipher suites of high strength. Currently, these are cipher suites using CHACHA20, AES, CAMELLIA, or GOST-28178-89-CNT symmetric encryption.
Cipher suites using IDEA for symmetric encryption. LibreSSL does not provide any such cipher suites.
Cipher suites using ephemeral DH for key exchange.
Cipher suites using ephemeral ECDH for key exchange.
Cipher suites using VKO 34.10 key exchange, specified in RFC 4357.
Cipher suites using RSA key exchange.
Cipher suites of low strength. Currently, these are cipher suites using DES or RC4 symmetric encryption.
Cipher suites using MD5 for message authentication.
Cipher suites of medium strength. Currently, these are cipher suites using 3DES symmetric encryption.
An alias for eNULL.
Cipher suites using RC4 for symmetric encryption.
Cipher suites using RSA for both key exchange and server authentication. Equivalent to kRSA+aRSA.
An alias for SHA1.
Cipher suites using SHA1 for message authentication.
Cipher suites using SHA256 for message authentication.
Cipher suites using SHA384 for message authentication.
An alias for TLSv1.
Cipher suites using STREEBOG256 for message authentication.
Cipher suites usable with any TLS protocol.
Cipher suites for the TLSv1.2 protocol.

The full words returned by the openssl(1) ciphers command can be used to select individual cipher suites.

Unknown words are silently ignored, selecting no cipher suites. Failure is only flagged if the control string contains invalid bytes or if no matching cipher suites are available at all.

On the client side, including a cipher suite into the list of available cipher suites is sufficient for using it. On the server side, all cipher suites have additional requirements. ADH ciphers don't need a certificate, but DH-parameters must have been set. All other cipher suites need a corresponding certificate and key.

A RSA cipher can only be chosen when an RSA certificate is available. RSA ciphers using DHE need a certificate and key and additional DH-parameters (see SSL_CTX_set_tmp_dh_callback(3)).

A DSA cipher can only be chosen when a DSA certificate is available. DSA ciphers always use DH key exchange and therefore need DH-parameters (see SSL_CTX_set_tmp_dh_callback(3)).

When these conditions are not met for any cipher suite in the list (for example, a client only supports export RSA ciphers with an asymmetric key length of 512 bits and the server is not configured to use temporary RSA keys), the “no shared cipher” (SSL_R_NO_SHARED_CIPHER) error is generated and the handshake will fail.

上一篇:IBM Spectrum LSF Suites


下一篇:列表页到对应的详情页 数据库读取