1 /* This example code is placed in the public domain. */
7 #include <gnutls/gnutls.h>
10 print_cipher_suite_list (const char* priorities
)
18 gnutls_protocol_t version
;
19 gnutls_priority_t pcache
;
21 if (priorities
!= NULL
)
23 printf ("Cipher suites for %s\n", priorities
);
25 ret
= gnutls_priority_init(&pcache
, priorities
, &err
);
28 fprintf (stderr
, "Syntax error at: %s\n", err
);
34 ret
= gnutls_priority_get_cipher_suite_index(pcache
, i
, &idx
);
35 if (ret
== GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE
) break;
36 if (ret
== GNUTLS_E_UNKNOWN_CIPHER_SUITE
) continue;
38 name
= gnutls_cipher_suite_info(idx
, id
, NULL
, NULL
, NULL
, &version
);
41 printf ("%-50s\t0x%02x, 0x%02x\t%s\n",
42 name
, (unsigned char) id
[0], (unsigned char) id
[1],
43 gnutls_protocol_get_name (version
));
50 int main(int argc
, char** argv
)
53 print_cipher_suite_list (argv
[1]);