设置 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:
DEFAULT
- An alias for
ALL
:!aNULL
:!eNULL
. It can only be used as the first word. @STRENGTH
- 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.
ADH
- Cipher suites using ephemeral DH for key exchange without doing any server authentication. Equivalent to
kEDH
+aNULL
. aDSS
- Cipher suites using DSS server authentication. LibreSSL does not provide any such cipher suites.
AEAD
- Cipher suites using Authenticated Encryption with Additional Data.
AECDH
- Cipher suites using ephemeral ECDH for key exchange without doing any server authentication. Equivalent to
kEECDH
+aNULL
. aECDSA
- Cipher suites using ECDSA server authentication.
AES
- Cipher suites using AES or AESGCM for symmetric encryption.
AES128
- Cipher suites using AES(128) or AESGCM(128) for symmetric encryption.
AES256
- Cipher suites using AES(256) or AESGCM(256) for symmetric encryption.
AESGCM
- Cipher suites using AESGCM for symmetric encryption.
aGOST
- An alias for
aGOST01
. aGOST01
- Cipher suites using GOST R 34.10-2001 server authentication.
ALL
- All cipher suites except those selected by
eNULL
. aNULL
- Cipher suites that don't do any server authentication. Not enabled by
DEFAULT
. Beware of man-in-the-middle attacks. aRSA
- Cipher suites using RSA server authentication.
CAMELLIA
- Cipher suites using Camellia for symmetric encryption.
CAMELLIA128
- Cipher suites using Camellia(128) for symmetric encryption.
CAMELLIA256
- Cipher suites using Camellia(256) for symmetric encryption.
CHACHA20
- Cipher suites using ChaCha20-Poly1305 for symmetric encryption.
COMPLEMENTOFALL
- Cipher suites that are not included in
ALL
. Currently an alias foreNULL
. COMPLEMENTOFDEFAULT
- Cipher suites that are included in
ALL
, but not included inDEFAULT
. Currently similar toaNULL
:!eNULL
except for the order of the cipher suites which are not selected. DES
- Cipher suites using single DES for symmetric encryption.
3DES
- Cipher suites using triple DES for symmetric encryption.
DH
- An alias for
kEDH
. DHE
- 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. DSS
- An alias for
aDSS
. ECDH
- An alias for
kEECHD
. ECDHE
- 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. ECDSA
- An alias for
aECDSA
. EDH
- An alias for
DHE
. EECHD
- An alias for
ECDHE
. eNULL
- Cipher suites that do not use any encryption. Not enabled by
DEFAULT
, and not even included inALL
. GOST89MAC
- Cipher suites using GOST 28147-89 for message authentication instead of HMAC.
GOST94
- Cipher suites using HMAC based on GOST R 34.11-94 for message authentication.
HIGH
- Cipher suites of high strength. Currently, these are cipher suites using
CHACHA20
,AES
,CAMELLIA
, or GOST-28178-89-CNT symmetric encryption. IDEA
- Cipher suites using IDEA for symmetric encryption. LibreSSL does not provide any such cipher suites.
kEDH
- Cipher suites using ephemeral DH for key exchange.
kEECDH
- Cipher suites using ephemeral ECDH for key exchange.
kGOST
- Cipher suites using VKO 34.10 key exchange, specified in RFC 4357.
kRSA
- Cipher suites using RSA key exchange.
LOW
- Cipher suites of low strength. Currently, these are cipher suites using
DES
orRC4
symmetric encryption. MD5
- Cipher suites using MD5 for message authentication.
MEDIUM
- Cipher suites of medium strength. Currently, these are cipher suites using
3DES
symmetric encryption. NULL
- An alias for
eNULL
. RC4
- Cipher suites using RC4 for symmetric encryption.
RSA
- Cipher suites using RSA for both key exchange and server authentication. Equivalent to
kRSA
+aRSA
. SHA
- An alias for
SHA1
. SHA1
- Cipher suites using SHA1 for message authentication.
SHA256
- Cipher suites using SHA256 for message authentication.
SHA384
- Cipher suites using SHA384 for message authentication.
SSLv3
- An alias for
TLSv1
. STREEBOG256
- Cipher suites using STREEBOG256 for message authentication.
TLSv1
- Cipher suites usable with any TLS protocol.
TLSv1.2
- 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.
标签:suites,encryption,symmetric,authentication,cipher,设置,using,suite 来源: https://www.cnblogs.com/liujx2019/p/11499249.html