1SSL_CIPHER_GET_NAME(3) OpenSSL SSL_CIPHER_GET_NAME(3)
2
3
4
6 SSL_CIPHER_get_name, SSL_CIPHER_standard_name, OPENSSL_cipher_name,
7 SSL_CIPHER_get_bits, SSL_CIPHER_get_version, SSL_CIPHER_description,
8 SSL_CIPHER_get_cipher_nid, SSL_CIPHER_get_digest_nid,
9 SSL_CIPHER_get_handshake_digest, SSL_CIPHER_get_kx_nid,
10 SSL_CIPHER_get_auth_nid, SSL_CIPHER_is_aead, SSL_CIPHER_find,
11 SSL_CIPHER_get_id, SSL_CIPHER_get_protocol_id - get SSL_CIPHER
12 properties
13
15 #include <openssl/ssl.h>
16
17 const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);
18 const char *SSL_CIPHER_standard_name(const SSL_CIPHER *cipher);
19 const char *OPENSSL_cipher_name(const char *stdname);
20 int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits);
21 char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher);
22 char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int size);
23 int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c);
24 int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c);
25 const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c);
26 int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c);
27 int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c);
28 int SSL_CIPHER_is_aead(const SSL_CIPHER *c);
29 const SSL_CIPHER *SSL_CIPHER_find(SSL *ssl, const unsigned char *ptr);
30 uint32_t SSL_CIPHER_get_id(const SSL_CIPHER *c);
31 uint32_t SSL_CIPHER_get_protocol_id(const SSL_CIPHER *c);
32
34 SSL_CIPHER_get_name() returns a pointer to the name of cipher. If the
35 cipher is NULL, it returns "(NONE)".
36
37 SSL_CIPHER_standard_name() returns a pointer to the standard RFC name
38 of cipher. If the cipher is NULL, it returns "(NONE)". If the cipher
39 has no standard name, it returns NULL. If cipher was defined in both
40 SSLv3 and TLS, it returns the TLS name.
41
42 OPENSSL_cipher_name() returns a pointer to the OpenSSL name of stdname.
43 If the stdname is NULL, or stdname has no corresponding OpenSSL name,
44 it returns "(NONE)". Where both exist, stdname should be the TLS name
45 rather than the SSLv3 name.
46
47 SSL_CIPHER_get_bits() returns the number of secret bits used for
48 cipher. If cipher is NULL, 0 is returned.
49
50 SSL_CIPHER_get_version() returns string which indicates the SSL/TLS
51 protocol version that first defined the cipher. It returns "(NONE)" if
52 cipher is NULL.
53
54 SSL_CIPHER_get_cipher_nid() returns the cipher NID corresponding to c.
55 If there is no cipher (e.g. for cipher suites with no encryption) then
56 NID_undef is returned.
57
58 SSL_CIPHER_get_digest_nid() returns the digest NID corresponding to the
59 MAC used by c during record encryption/decryption. If there is no
60 digest (e.g. for AEAD cipher suites) then NID_undef is returned.
61
62 SSL_CIPHER_get_handshake_digest() returns an EVP_MD for the digest used
63 during the SSL/TLS handshake when using the SSL_CIPHER c. Note that
64 this may be different to the digest used to calculate the MAC for
65 encrypted records.
66
67 SSL_CIPHER_get_kx_nid() returns the key exchange NID corresponding to
68 the method used by c. If there is no key exchange, then NID_undef is
69 returned. If any appropriate key exchange algorithm can be used (as in
70 the case of TLS 1.3 cipher suites) NID_kx_any is returned. Examples
71 (not comprehensive):
72
73 NID_kx_rsa
74 NID_kx_ecdhe
75 NID_kx_dhe
76 NID_kx_psk
77
78 SSL_CIPHER_get_auth_nid() returns the authentication NID corresponding
79 to the method used by c. If there is no authentication, then NID_undef
80 is returned. If any appropriate authentication algorithm can be used
81 (as in the case of TLS 1.3 cipher suites) NID_auth_any is returned.
82 Examples (not comprehensive):
83
84 NID_auth_rsa
85 NID_auth_ecdsa
86 NID_auth_psk
87
88 SSL_CIPHER_is_aead() returns 1 if the cipher c is AEAD (e.g. GCM or
89 ChaCha20/Poly1305), and 0 if it is not AEAD.
90
91 SSL_CIPHER_find() returns a SSL_CIPHER structure which has the cipher
92 ID stored in ptr. The ptr parameter is a two element array of char,
93 which stores the two-byte TLS cipher ID (as allocated by IANA) in
94 network byte order. This parameter is usually retrieved from a TLS
95 packet by using functions like SSL_client_hello_get0_ciphers(3).
96 SSL_CIPHER_find() returns NULL if an error occurs or the indicated
97 cipher is not found.
98
99 SSL_CIPHER_get_id() returns the OpenSSL-specific ID of the given cipher
100 c. That ID is not the same as the IANA-specific ID.
101
102 SSL_CIPHER_get_protocol_id() returns the two-byte ID used in the TLS
103 protocol of the given cipher c.
104
105 SSL_CIPHER_description() returns a textual description of the cipher
106 used into the buffer buf of length len provided. If buf is provided,
107 it must be at least 128 bytes, otherwise a buffer will be allocated
108 using OPENSSL_malloc(). If the provided buffer is too small, or the
109 allocation fails, NULL is returned.
110
111 The string returned by SSL_CIPHER_description() consists of several
112 fields separated by whitespace:
113
114 <ciphername>
115 Textual representation of the cipher name.
116
117 <protocol version>
118 Protocol version, such as TLSv1.2, when the cipher was first
119 defined.
120
121 Kx=<key exchange>
122 Key exchange method such as RSA, ECDHE, etc.
123
124 Au=<authentication>
125 Authentication method such as RSA, None, etc.. None is the
126 representation of anonymous ciphers.
127
128 Enc=<symmetric encryption method>
129 Encryption method, with number of secret bits, such as AESGCM(128).
130
131 Mac=<message authentication code>
132 Message digest, such as SHA256.
133
134 Some examples for the output of SSL_CIPHER_description():
135
136 ECDHE-RSA-AES256-GCM-SHA256 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD
137 RSA-PSK-AES256-CBC-SHA384 TLSv1.0 Kx=RSAPSK Au=RSA Enc=AES(256) Mac=SHA384
138
140 SSL_CIPHER_get_name(), SSL_CIPHER_standard_name(),
141 OPENSSL_cipher_name(), SSL_CIPHER_get_version() and
142 SSL_CIPHER_description() return the corresponding value in a null-
143 terminated string for a specific cipher or "(NONE)" if the cipher is
144 not found.
145
146 SSL_CIPHER_get_bits() returns a positive integer representing the
147 number of secret bits or 0 if an error occurred.
148
149 SSL_CIPHER_get_cipher_nid(), SSL_CIPHER_get_digest_nid(),
150 SSL_CIPHER_get_kx_nid() and SSL_CIPHER_get_auth_nid() return the NID
151 value or NID_undef if an error occurred.
152
153 SSL_CIPHER_get_handshake_digest() returns a valid EVP_MD structure or
154 NULL if an error occurred.
155
156 SSL_CIPHER_is_aead() returns 1 if the cipher is AEAD or 0 otherwise.
157
158 SSL_CIPHER_find() returns a valid SSL_CIPHER structure or NULL if an
159 error occurred.
160
161 SSL_CIPHER_get_id() returns a 4-byte integer representing the OpenSSL-
162 specific ID.
163
164 SSL_CIPHER_get_protocol_id() returns a 2-byte integer representing the
165 TLS protocol-specific ID.
166
168 SSL_CIPHER_get_version() was updated to always return the correct
169 protocol string in OpenSSL 1.1.0.
170
171 SSL_CIPHER_description() was changed to return NULL on error, rather
172 than a fixed string, in OpenSSL 1.1.0.
173
174 SSL_CIPHER_get_handshake_digest() was added in OpenSSL 1.1.1.
175
176 SSL_CIPHER_standard_name() was globally available in OpenSSL 1.1.1.
177 Before OpenSSL 1.1.1, tracing (enable-ssl-trace argument to Configure)
178 was required to enable this function.
179
180 OPENSSL_cipher_name() was added in OpenSSL 1.1.1.
181
183 ssl(7), SSL_get_current_cipher(3), SSL_get_ciphers(3), ciphers(1)
184
186 Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
187
188 Licensed under the OpenSSL license (the "License"). You may not use
189 this file except in compliance with the License. You can obtain a copy
190 in the file LICENSE in the source distribution or at
191 <https://www.openssl.org/source/license.html>.
192
193
194
1951.1.1 2018-09-11 SSL_CIPHER_GET_NAME(3)