Document SSL_CIPHER_get_handshake_digest()
[openssl.git] / doc / man3 / SSL_CIPHER_get_name.pod
1 =pod
2
3 =head1 NAME
4
5 SSL_CIPHER_get_name,
6 SSL_CIPHER_get_bits,
7 SSL_CIPHER_get_version,
8 SSL_CIPHER_description,
9 SSL_CIPHER_get_cipher_nid,
10 SSL_CIPHER_get_digest_nid,
11 SSL_CIPHER_get_handshake_digest,
12 SSL_CIPHER_get_kx_nid,
13 SSL_CIPHER_get_auth_nid,
14 SSL_CIPHER_is_aead
15 - get SSL_CIPHER properties
16
17 =head1 SYNOPSIS
18
19  #include <openssl/ssl.h>
20
21  const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);
22  int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits);
23  char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher);
24  char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int size);
25  int SSL_CIPHER_get_cipher_nid(const SSL_CIPHER *c);
26  int SSL_CIPHER_get_digest_nid(const SSL_CIPHER *c);
27  const EVP_MD *SSL_CIPHER_get_handshake_digest(const SSL_CIPHER *c);
28  int SSL_CIPHER_get_kx_nid(const SSL_CIPHER *c);
29  int SSL_CIPHER_get_auth_nid(const SSL_CIPHER *c);
30  int SSL_CIPHER_is_aead(const SSL_CIPHER *c);
31
32 =head1 DESCRIPTION
33
34 SSL_CIPHER_get_name() returns a pointer to the name of B<cipher>. If the
35 B<cipher> is NULL, it returns "(NONE)".
36
37 SSL_CIPHER_get_bits() returns the number of secret bits used for B<cipher>.
38 If B<cipher> is NULL, 0 is returned.
39
40 SSL_CIPHER_get_version() returns string which indicates the SSL/TLS protocol
41 version that first defined the cipher.  It returns "(NONE)" if B<cipher> is NULL.
42
43 SSL_CIPHER_get_cipher_nid() returns the cipher NID corresponding to B<c>.
44 If there is no cipher (e.g. for cipher suites with no encryption) then
45 B<NID_undef> is returned.
46
47 SSL_CIPHER_get_digest_nid() returns the digest NID corresponding to the MAC
48 used by B<c> during record encryption/decryption. If there is no digest (e.g.
49 for AEAD cipher suites) then B<NID_undef> is returned.
50
51 SSL_CIPHER_get_handshake_digest() returns an EVP_MD for the digest used during
52 the SSL/TLS handshake when using the SSL_CIPHER B<c>. Note that this may be
53 different to the digest used to calculate the MAC for encrypted records.
54
55 SSL_CIPHER_get_kx_nid() returns the key exchange NID corresponding to the method
56 used by B<c>. If there is no key exchange, then B<NID_undef> is returned.
57 If any appropriate key exchange algorithm can be used (as in the case of TLS 1.3
58 cipher suites) B<NID_kx_any> is returned. Examples (not comprehensive):
59
60  NID_kx_rsa
61  NID_kx_ecdhe
62  NID_kx_dhe
63  NID_kx_psk
64
65 SSL_CIPHER_get_auth_nid() returns the authentication NID corresponding to the method
66 used by B<c>. If there is no authentication, then B<NID_undef> is returned.
67 If any appropriate authentication algorithm can be used (as in the case of
68 TLS 1.3 cipher suites) B<NID_auth_any> is returned. Examples (not comprehensive):
69
70  NID_auth_rsa
71  NID_auth_ecdsa
72  NID_auth_psk
73
74 SSL_CIPHER_is_aead() returns 1 if the cipher B<c> is AEAD (e.g. GCM or
75 ChaCha20/Poly1305), and 0 if it is not AEAD.
76
77 SSL_CIPHER_description() returns a textual description of the cipher used
78 into the buffer B<buf> of length B<len> provided.  If B<buf> is provided, it
79 must be at least 128 bytes, otherwise a buffer will be allocated using
80 OPENSSL_malloc().  If the provided buffer is too small, or the allocation fails,
81 B<NULL> is returned.
82
83 The string returned by SSL_CIPHER_description() consists of several fields
84 separated by whitespace:
85
86 =over 4
87
88 =item <ciphername>
89
90 Textual representation of the cipher name.
91
92 =item <protocol version>
93
94 Protocol version, such as B<TLSv1.2>, when the cipher was first defined.
95
96 =item Kx=<key exchange>
97
98 Key exchange method such as B<RSA>, B<ECDHE>, etc.
99
100 =item Au=<authentication>
101
102 Authentication method such as B<RSA>, B<None>, etc.. None is the
103 representation of anonymous ciphers.
104
105 =item Enc=<symmetric encryption method>
106
107 Encryption method, with number of secret bits, such as B<AESGCM(128)>.
108
109 =item Mac=<message authentication code>
110
111 Message digest, such as B<SHA256>.
112
113 =back
114
115 Some examples for the output of SSL_CIPHER_description():
116
117  ECDHE-RSA-AES256-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD
118  RSA-PSK-AES256-CBC-SHA384 TLSv1.0 Kx=RSAPSK   Au=RSA  Enc=AES(256)  Mac=SHA384
119
120 =head1 HISTORY
121
122 SSL_CIPHER_get_version() was updated to always return the correct protocol
123 string in OpenSSL 1.1.0.
124
125 SSL_CIPHER_description() was changed to return B<NULL> on error,
126 rather than a fixed string, in OpenSSL 1.1.0.
127
128 SSL_CIPHER_get_handshake_digest() was added in OpenSSL 1.1.1.
129
130 =head1 SEE ALSO
131
132 L<ssl(7)>, L<SSL_get_current_cipher(3)>,
133 L<SSL_get_ciphers(3)>, L<ciphers(1)>
134
135 =head1 COPYRIGHT
136
137 Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.
138
139 Licensed under the OpenSSL license (the "License").  You may not use
140 this file except in compliance with the License.  You can obtain a copy
141 in the file LICENSE in the source distribution or at
142 L<https://www.openssl.org/source/license.html>.
143
144 =cut