1*2175Sjp161948=pod 2*2175Sjp161948 3*2175Sjp161948=head1 NAME 4*2175Sjp161948 5*2175Sjp161948SSL_CIPHER_get_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version, SSL_CIPHER_description - get SSL_CIPHER properties 6*2175Sjp161948 7*2175Sjp161948=head1 SYNOPSIS 8*2175Sjp161948 9*2175Sjp161948 #include <openssl/ssl.h> 10*2175Sjp161948 11*2175Sjp161948 const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher); 12*2175Sjp161948 int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits); 13*2175Sjp161948 char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher); 14*2175Sjp161948 char *SSL_CIPHER_description(SSL_CIPHER *cipher, char *buf, int size); 15*2175Sjp161948 16*2175Sjp161948=head1 DESCRIPTION 17*2175Sjp161948 18*2175Sjp161948SSL_CIPHER_get_name() returns a pointer to the name of B<cipher>. If the 19*2175Sjp161948argument is the NULL pointer, a pointer to the constant value "NONE" is 20*2175Sjp161948returned. 21*2175Sjp161948 22*2175Sjp161948SSL_CIPHER_get_bits() returns the number of secret bits used for B<cipher>. If 23*2175Sjp161948B<alg_bits> is not NULL, it contains the number of bits processed by the 24*2175Sjp161948chosen algorithm. If B<cipher> is NULL, 0 is returned. 25*2175Sjp161948 26*2175Sjp161948SSL_CIPHER_get_version() returns the protocol version for B<cipher>, currently 27*2175Sjp161948"SSLv2", "SSLv3", or "TLSv1". If B<cipher> is NULL, "(NONE)" is returned. 28*2175Sjp161948 29*2175Sjp161948SSL_CIPHER_description() returns a textual description of the cipher used 30*2175Sjp161948into the buffer B<buf> of length B<len> provided. B<len> must be at least 31*2175Sjp161948128 bytes, otherwise a pointer to the the string "Buffer too small" is 32*2175Sjp161948returned. If B<buf> is NULL, a buffer of 128 bytes is allocated using 33*2175Sjp161948OPENSSL_malloc(). If the allocation fails, a pointer to the string 34*2175Sjp161948"OPENSSL_malloc Error" is returned. 35*2175Sjp161948 36*2175Sjp161948=head1 NOTES 37*2175Sjp161948 38*2175Sjp161948The number of bits processed can be different from the secret bits. An 39*2175Sjp161948export cipher like e.g. EXP-RC4-MD5 has only 40 secret bits. The algorithm 40*2175Sjp161948does use the full 128 bits (which would be returned for B<alg_bits>), of 41*2175Sjp161948which however 88bits are fixed. The search space is hence only 40 bits. 42*2175Sjp161948 43*2175Sjp161948The string returned by SSL_CIPHER_description() in case of success consists 44*2175Sjp161948of cleartext information separated by one or more blanks in the following 45*2175Sjp161948sequence: 46*2175Sjp161948 47*2175Sjp161948=over 4 48*2175Sjp161948 49*2175Sjp161948=item <ciphername> 50*2175Sjp161948 51*2175Sjp161948Textual representation of the cipher name. 52*2175Sjp161948 53*2175Sjp161948=item <protocol version> 54*2175Sjp161948 55*2175Sjp161948Protocol version: B<SSLv2>, B<SSLv3>. The TLSv1 ciphers are flagged with SSLv3. 56*2175Sjp161948 57*2175Sjp161948=item Kx=<key exchange> 58*2175Sjp161948 59*2175Sjp161948Key exchange method: B<RSA> (for export ciphers as B<RSA(512)> or 60*2175Sjp161948B<RSA(1024)>), B<DH> (for export ciphers as B<DH(512)> or B<DH(1024)>), 61*2175Sjp161948B<DH/RSA>, B<DH/DSS>, B<Fortezza>. 62*2175Sjp161948 63*2175Sjp161948=item Au=<authentication> 64*2175Sjp161948 65*2175Sjp161948Authentication method: B<RSA>, B<DSS>, B<DH>, B<None>. None is the 66*2175Sjp161948representation of anonymous ciphers. 67*2175Sjp161948 68*2175Sjp161948=item Enc=<symmetric encryption method> 69*2175Sjp161948 70*2175Sjp161948Encryption method with number of secret bits: B<DES(40)>, B<DES(56)>, 71*2175Sjp161948B<3DES(168)>, B<RC4(40)>, B<RC4(56)>, B<RC4(64)>, B<RC4(128)>, 72*2175Sjp161948B<RC2(40)>, B<RC2(56)>, B<RC2(128)>, B<IDEA(128)>, B<Fortezza>, B<None>. 73*2175Sjp161948 74*2175Sjp161948=item Mac=<message authentication code> 75*2175Sjp161948 76*2175Sjp161948Message digest: B<MD5>, B<SHA1>. 77*2175Sjp161948 78*2175Sjp161948=item <export flag> 79*2175Sjp161948 80*2175Sjp161948If the cipher is flagged exportable with respect to old US crypto 81*2175Sjp161948regulations, the word "B<export>" is printed. 82*2175Sjp161948 83*2175Sjp161948=back 84*2175Sjp161948 85*2175Sjp161948=head1 EXAMPLES 86*2175Sjp161948 87*2175Sjp161948Some examples for the output of SSL_CIPHER_description(): 88*2175Sjp161948 89*2175Sjp161948 EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1 90*2175Sjp161948 EDH-DSS-DES-CBC3-SHA SSLv3 Kx=DH Au=DSS Enc=3DES(168) Mac=SHA1 91*2175Sjp161948 RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5 92*2175Sjp161948 EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export 93*2175Sjp161948 94*2175Sjp161948=head1 BUGS 95*2175Sjp161948 96*2175Sjp161948If SSL_CIPHER_description() is called with B<cipher> being NULL, the 97*2175Sjp161948library crashes. 98*2175Sjp161948 99*2175Sjp161948If SSL_CIPHER_description() cannot handle a built-in cipher, the according 100*2175Sjp161948description of the cipher property is B<unknown>. This case should not 101*2175Sjp161948occur. 102*2175Sjp161948 103*2175Sjp161948=head1 RETURN VALUES 104*2175Sjp161948 105*2175Sjp161948See DESCRIPTION 106*2175Sjp161948 107*2175Sjp161948=head1 SEE ALSO 108*2175Sjp161948 109*2175Sjp161948L<ssl(3)|ssl(3)>, L<SSL_get_current_cipher(3)|SSL_get_current_cipher(3)>, 110*2175Sjp161948L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, L<ciphers(1)|ciphers(1)> 111*2175Sjp161948 112*2175Sjp161948=cut 113