
#use wml::openssl-macros area=docs page=SSL_CIPHER_get_name

<title>Documents, SSL_CIPHER_get_name(3)</title>

<h1>SSL_CIPHER_get_name(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#NOTES">NOTES</A>
	<LI><A HREF="#EXAMPLES">EXAMPLES</A>
	<LI><A HREF="#BUGS">BUGS</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
SSL_CIPHER_get_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version,
SSL_CIPHER_description - get SSL_CIPHER properties

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/ssl.h&gt;
</PRE>
<PRE> const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher);
 int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits);
 char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher);
 char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int size);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>SSL_CIPHER_get_name()</CODE> returns a pointer to the name of <STRONG>cipher</STRONG>. If the argument is the NULL pointer, a pointer to the constant value
``NONE'' is returned.

</P>
<P>
<CODE>SSL_CIPHER_get_bits()</CODE> returns the number of secret bits used
for <STRONG>cipher</STRONG>. If
<STRONG>alg_bits</STRONG> is not NULL, it contains the number of bits processed by the chosen
algorithm. If <STRONG>cipher</STRONG> is NULL, 0 is returned.

</P>
<P>
<CODE>SSL_CIPHER_get_version()</CODE> returns the protocol version for <STRONG>cipher</STRONG>, currently ``SSLv2'', ``SSLv3'', or ``TLSv1''. If <STRONG>cipher</STRONG> is NULL, ``(NONE)'' is returned.

</P>
<P>
<CODE>SSL_CIPHER_description()</CODE> returns a textual description of the
cipher used into the buffer <STRONG>buf</STRONG> of length <STRONG>len</STRONG> provided. <STRONG>len</STRONG> must be at least 128 bytes, otherwise a pointer to the string ``Buffer too
small'' is returned. If <STRONG>buf</STRONG> is NULL, a buffer of 128 bytes is allocated using
<CODE>OPENSSL_malloc().</CODE> If the allocation fails, a pointer to the
string ``OPENSSL_malloc Error'' is returned.

</P>
<P>
<HR>
<H1><A NAME="NOTES">NOTES</A></H1>
<P>
The number of bits processed can be different from the secret bits. An
export cipher like e.g. EXP-RC4-MD5 has only 40 secret bits. The algorithm
does use the full 128 bits (which would be returned for <STRONG>alg_bits</STRONG>), of which however 88bits are fixed. The search space is hence only 40
bits.

</P>
<P>
The string returned by <CODE>SSL_CIPHER_description()</CODE> in case of
success consists of cleartext information separated by one or more blanks
in the following sequence:

</P>
<DL>
<DT><STRONG><A NAME="item__ciphername_"><ciphername></A></STRONG><DD>
<P>
Textual representation of the cipher name.

</P>
<DT><STRONG><A NAME="item__protocol"><protocol version></A></STRONG><DD>
<P>
Protocol version: <STRONG>SSLv2</STRONG>, <STRONG>SSLv3</STRONG>. The TLSv1 ciphers are flagged with SSLv3.

</P>
<DT><STRONG><A NAME="item_Kx">Kx=<key exchange></A></STRONG><DD>
<P>
Key exchange method: <STRONG>RSA</STRONG> (for export ciphers as <STRONG>RSA(512)</STRONG> or
<STRONG>RSA(1024)</STRONG>), <STRONG>DH</STRONG> (for export ciphers as <STRONG>DH(512)</STRONG> or <STRONG>DH(1024)</STRONG>),
<STRONG>DH/RSA</STRONG>, <STRONG>DH/DSS</STRONG>, <STRONG>Fortezza</STRONG>.

</P>
<DT><STRONG><A NAME="item_Au">Au=<authentication></A></STRONG><DD>
<P>
Authentication method: <STRONG>RSA</STRONG>, <STRONG>DSS</STRONG>, <STRONG>DH</STRONG>, <STRONG>None</STRONG>. None is the representation of anonymous ciphers.

</P>
<DT><STRONG><A NAME="item_Enc">Enc=<symmetric encryption method></A></STRONG><DD>
<P>
Encryption method with number of secret bits: <STRONG>DES(40)</STRONG>, <STRONG>DES(56)</STRONG>,
<STRONG>3DES(168)</STRONG>, <STRONG>RC4(40)</STRONG>, <STRONG>RC4(56)</STRONG>, <STRONG>RC4(64)</STRONG>, <STRONG>RC4(128)</STRONG>,
<STRONG>RC2(40)</STRONG>, <STRONG>RC2(56)</STRONG>, <STRONG>RC2(128)</STRONG>, <STRONG>IDEA(128)</STRONG>, <STRONG>Fortezza</STRONG>, <STRONG>None</STRONG>.

</P>
<DT><STRONG><A NAME="item_Mac">Mac=<message authentication code></A></STRONG><DD>
<P>
Message digest: <STRONG>MD5</STRONG>, <STRONG>SHA1</STRONG>.

</P>
<DT><STRONG><A NAME="item__export"><export flag></A></STRONG><DD>
<P>
If the cipher is flagged exportable with respect to old US crypto
regulations, the word ``<STRONG>export</STRONG>'' is printed.

</P>
</DL>
<P>
<HR>
<H1><A NAME="EXAMPLES">EXAMPLES</A></H1>
<P>
Some examples for the output of <CODE>SSL_CIPHER_description():</CODE>

</P>
<PRE> EDH-RSA-DES-CBC3-SHA    SSLv3 Kx=DH       Au=RSA  Enc=3DES(168) Mac=SHA1
 EDH-DSS-DES-CBC3-SHA    SSLv3 Kx=DH       Au=DSS  Enc=3DES(168) Mac=SHA1
 RC4-MD5                 SSLv3 Kx=RSA      Au=RSA  Enc=RC4(128)  Mac=MD5
 EXP-RC4-MD5             SSLv3 Kx=RSA(512) Au=RSA  Enc=RC4(40)   Mac=MD5  export
</PRE>
<P>
<HR>
<H1><A NAME="BUGS">BUGS</A></H1>
<P>
If <CODE>SSL_CIPHER_description()</CODE> is called with <STRONG>cipher</STRONG> being NULL, the library crashes.

</P>
<P>
If <CODE>SSL_CIPHER_description()</CODE> cannot handle a built-in cipher,
the according description of the cipher property is <STRONG>unknown</STRONG>. This case should not occur.

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
See DESCRIPTION

</P>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../ssl/ssl.html#">ssl(3)</A>, <A HREF="../ssl/SSL_get_current_cipher.html#">SSL_get_current_cipher(3)</A>,
<A HREF="../ssl/SSL_get_ciphers.html#">SSL_get_ciphers(3)</A>, <A HREF="../apps/ciphers.html#">ciphers(1)</A>



</P>
:}

