.\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.3 2017/07/05 11:43:09 schwarze Exp $ .\" OpenSSL 45f55f6a Nov 30 15:35:22 2014 +0100 .\" .\" This file was written by Lutz Jaenicke . .\" Copyright (c) 2000, 2001, 2005, 2009, 2013, 2014 The OpenSSL Project. .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in .\" the documentation and/or other materials provided with the .\" distribution. .\" .\" 3. All advertising materials mentioning features or use of this .\" software must display the following acknowledgment: .\" "This product includes software developed by the OpenSSL Project .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" .\" .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to .\" endorse or promote products derived from this software without .\" prior written permission. For written permission, please contact .\" openssl-core@openssl.org. .\" .\" 5. Products derived from this software may not be called "OpenSSL" .\" nor may "OpenSSL" appear in their names without prior written .\" permission of the OpenSSL Project. .\" .\" 6. Redistributions of any form whatsoever must retain the following .\" acknowledgment: .\" "This product includes software developed by the OpenSSL Project .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" .\" .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED .\" OF THE POSSIBILITY OF SUCH DAMAGE. .\" .Dd $Mdocdate: July 5 2017 $ .Dt SSL_CIPHER_GET_NAME 3 .Os .Sh NAME .Nm SSL_CIPHER_get_name , .Nm SSL_CIPHER_get_bits , .Nm SSL_CIPHER_get_version , .Nm SSL_CIPHER_description .Nd get SSL_CIPHER properties .Sh SYNOPSIS .In openssl/ssl.h .Ft const char * .Fn SSL_CIPHER_get_name "const SSL_CIPHER *cipher" .Ft int .Fn SSL_CIPHER_get_bits "const SSL_CIPHER *cipher" "int *alg_bits" .Ft char * .Fn SSL_CIPHER_get_version "const SSL_CIPHER *cipher" .Ft char * .Fn SSL_CIPHER_description "const SSL_CIPHER *cipher" "char *buf" "int size" .Sh DESCRIPTION .Fn SSL_CIPHER_get_name returns a pointer to the name of .Fa cipher . If the .Fa cipher is .Dv NULL , it returns .Qq (NONE) . .Pp .Fn SSL_CIPHER_get_bits returns the number of secret bits used for .Fa cipher . If .Fa alg_bits is not .Dv NULL , it contains the number of bits processed by the chosen algorithm. If .Fa cipher is .Dv NULL , 0 is returned. .Pp .Fn SSL_CIPHER_get_version returns a string which indicates the SSL/TLS protocol version that first defined the cipher. This is currently .Qq TLSv1/SSLv3 . In some cases it should possibly return .Qq TLSv1.2 but the function does not; use .Fn SSL_CIPHER_description instead. If .Fa cipher is .Dv NULL , .Qq (NONE) is returned. .Pp .Fn SSL_CIPHER_description returns a textual description of the cipher used into the buffer .Fa buf of length .Fa len provided. If .Fa buf is .Dv NULL , a buffer is allocated using .Xr asprintf 3 ; that buffer should be freed using the .Xr free 3 function. If .Fa len is too small, or if .Fa buf is .Dv NULL and the allocation fails, a pointer to the string .Qq Buffer too small is returned. .Pp The string returned by .Fn SSL_CIPHER_description consists of several fields separated by whitespace: .Bl -tag -width Ds .It Aq Ar ciphername Textual representation of the cipher name. .It Aq Ar protocol version Protocol version: .Sy SSLv3 or .Sy TLSv1.2 . The TLSv1.0 ciphers are flagged with SSLv3. No new ciphers were added by TLSv1.1. .It Kx= Ns Aq Ar key exchange Key exchange method: .Sy DH , .Sy ECDH , .Sy GOST , or .Sy RSA . .It Au= Ns Aq Ar authentication Authentication method: .Sy DSS , .Sy ECDSA , .Sy GOST01 , .Sy RSA , or .Sy None . .Sy None is the representation of anonymous ciphers. .It Enc= Ns Aq Ar symmetric encryption method Encryption method with number of secret bits: .Sy DES(56) , .Sy 3DES(168) , .Sy RC4(64) , .Sy RC4(128) , .Sy IDEA(128) , .Sy AES(128) , .Sy AES(256) , .Sy AESCGM(128) , .Sy AESCGM(256) , .Sy Camellia(128) , .Sy Camellia(256) , .Sy ChaCha20-Poly1305 , .Sy ChaCha20-Poly1305-Old , .Sy GOST-28178-89-CNT , or .Sy None . .It Mac= Ns Aq Ar message authentication code Message digest: .Sy MD5 , .Sy SHA1 , .Sy SHA256 , .Sy SHA384 , .Sy AEAD , .Sy GOST94 , .Sy GOST89IMIT , .Sy STREEBOG256 , .Sy STREEBOG512 . .El .Sh EXAMPLES An example for the output of .Fn SSL_CIPHER_description : .Bd -literal ECDHE-RSA-AES256-GCM-SHA256 TLSv1.2 Kx=ECDH Au=RSA Enc=AESGCM(256) Mac=AEAD .Ed .Pp A complete list can be retrieved by invoking the following command: .Pp .Dl $ openssl ciphers -v ALL .Sh SEE ALSO .Xr openssl 1 , .Xr ssl 3 , .Xr SSL_get_ciphers 3 , .Xr SSL_get_current_cipher 3 .Sh BUGS If .Fn SSL_CIPHER_description is called with .Fa cipher being .Dv NULL , the library crashes. .Pp If .Fn SSL_CIPHER_description cannot handle a built-in cipher, the according description of the cipher property is .Qq unknown . This case should not occur.