2 * Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
3 * Author: Nikos Mavrogiannopoulos
5 * This file is part of GnuTLS.
7 * GnuTLS is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
12 * GnuTLS is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include <gnutls/gnutls.h>
26 #include <gnutls/x509.h>
27 #include <gnutls/openpgp.h>
29 static void main_texinfo (void);
30 static void main_latex(void);
33 main (int argc
, char *argv
[])
43 static void main_texinfo (void)
49 gnutls_kx_algorithm_t kx
;
50 gnutls_cipher_algorithm_t cipher
;
51 gnutls_mac_algorithm_t mac
;
52 gnutls_protocol_t version
;
54 printf ("Available cipher suites:\n");
56 printf ("@multitable @columnfractions .60 .20 .20\n");
57 for (i
= 0; (name
= gnutls_cipher_suite_info
58 (i
, id
, &kx
, &cipher
, &mac
, &version
)); i
++)
60 printf ("@item %s\n@tab 0x%02X 0x%02X\n@tab %s\n",
62 (unsigned char) id
[0], (unsigned char) id
[1],
63 gnutls_protocol_get_name (version
));
65 printf ("@end multitable\n");
70 const gnutls_certificate_type_t
*p
= gnutls_certificate_type_list ();
72 printf ("\n\nAvailable certificate types:\n@itemize\n");
75 printf ("@item %s\n", gnutls_certificate_type_get_name (*p
));
77 printf ("@end itemize\n");
81 const gnutls_protocol_t
*p
= gnutls_protocol_list ();
83 printf ("\nAvailable protocols:\n@itemize\n");
86 printf ("@item %s\n", gnutls_protocol_get_name (*p
));
88 printf ("@end itemize\n");
92 const gnutls_cipher_algorithm_t
*p
= gnutls_cipher_list ();
94 printf ("\nAvailable ciphers:\n@itemize\n");
97 printf ("@item %s\n", gnutls_cipher_get_name (*p
));
99 printf ("@end itemize\n");
103 const gnutls_mac_algorithm_t
*p
= gnutls_mac_list ();
105 printf ("\nAvailable MAC algorithms:\n@itemize\n");
108 printf ("@item %s\n", gnutls_mac_get_name (*p
));
110 printf ("@end itemize\n");
114 const gnutls_kx_algorithm_t
*p
= gnutls_kx_list ();
116 printf ("\nAvailable key exchange methods:\n@itemize\n");
119 printf ("@item %s\n", gnutls_kx_get_name (*p
));
121 printf ("@end itemize\n");
125 const gnutls_pk_algorithm_t
*p
= gnutls_pk_list ();
127 printf ("\nAvailable public key algorithms:\n@itemize\n");
130 printf ("@item %s\n", gnutls_pk_get_name (*p
));
132 printf ("@end itemize\n");
136 const gnutls_sign_algorithm_t
*p
= gnutls_sign_list ();
138 printf ("\nAvailable public key signature algorithms:\n@itemize\n");
141 printf ("@item %s\n", gnutls_sign_get_name (*p
));
143 printf ("@end itemize\n");
147 const gnutls_compression_method_t
*p
= gnutls_compression_list ();
149 printf ("\nAvailable compression methods:\n@itemize\n");
152 printf ("@item %s\n", gnutls_compression_get_name (*p
));
154 printf ("@end itemize\n");
158 static const char headers
[] = "\\tablefirsthead{%\n"
160 "Ciphersuite name & TLS ID & since\\\\\n"
164 "\\multicolumn{3}{|l|}{\\small\\sl continued from previous page}\\\\\n"
168 "\\multicolumn{3}{|r|}{\\small\\sl continued on next page}\\\\\n"
170 "\\tablelasttail{\\hline}\n"
171 "\\bottomcaption{The ciphersuites table}\n\n";
173 static char* escape_string( const char* str
)
175 static char buffer
[500];
179 while( str
[i
] != 0 && j
< sizeof(buffer
) - 1) {
184 buffer
[j
++] = str
[i
];
195 static void main_latex(void)
203 printf("\\begin{supertabular}{|p{.60\\linewidth}|p{.15\\linewidth}|p{.10\\linewidth}|}\n");
209 gnutls_kx_algorithm_t kx
;
210 gnutls_cipher_algorithm_t cipher
;
211 gnutls_mac_algorithm_t mac
;
212 gnutls_protocol_t version
;
214 for (i
= 0; (name
= gnutls_cipher_suite_info
215 (i
, id
, &kx
, &cipher
, &mac
, &version
)); i
++)
217 printf ("{\\small{%s}} & \\code{0x%02X 0x%02X} & %s",
219 (unsigned char) id
[0], (unsigned char) id
[1],
220 gnutls_protocol_get_name (version
));
223 printf("\\end{supertabular}\n\n");