From: Nikos Mavrogiannopoulos Date: Mon, 26 Aug 2002 10:13:15 +0000 (+0000) Subject: Improved the gnutls-cli-debug program X-Git-Tag: gnutls_0_5_4~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36387d6efaa585293e933df601165dcd9fef4f1a;p=thirdparty%2Fgnutls.git Improved the gnutls-cli-debug program --- diff --git a/src/Makefile.am b/src/Makefile.am index 687f6c9ba9..aa5e757a61 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,7 +12,7 @@ gnutls_srpcrypt_SOURCES = crypt-gaa.c crypt.c gnutls_srpcrypt_LDADD = ../lib/libgnutls.la ../libextra/libgnutls-extra.la $(LIBGCRYPT_LIBS) $(LIBOPENCDK_LIBS) gnutls_cli_SOURCES = cli-gaa.c cli.c common.c gnutls_cli_LDADD = ../lib/libgnutls.la ../libextra/libgnutls-extra.la $(LIBGCRYPT_LIBS) $(LIBOPENCDK_LIBS) -gnutls_cli_debug_SOURCES = tls_test-gaa.c tls_test.c tests.c +gnutls_cli_debug_SOURCES = tls_test-gaa.c tls_test.c tests.c common.c gnutls_cli_debug_LDADD = ../lib/libgnutls.la ../libextra/libgnutls-extra.la $(LIBGCRYPT_LIBS) $(LIBOPENCDK_LIBS) diff --git a/src/common.c b/src/common.c index 6f7eadf8f5..4f0fbc54c0 100644 --- a/src/common.c +++ b/src/common.c @@ -3,6 +3,8 @@ #include #include +void print_cert_info(GNUTLS_STATE state); + #define PRINTX(x,y) if (y[0]!=0) printf(" # %s %s\n", x, y) #define PRINT_DN(X) PRINTX( "CN:", X.common_name); \ PRINTX( "OU:", X.organizational_unit_name); \ @@ -223,23 +225,7 @@ int print_info(GNUTLS_STATE state) gnutls_srp_server_get_username(state)); break; case GNUTLS_CRD_CERTIFICATE: - switch (gnutls_cert_type_get(state)) { - case GNUTLS_CRT_X509: - printf - ("- Peer requested X.509 certificate authentication.\n"); - - print_x509_info(state); - - break; - case GNUTLS_CRT_OPENPGP:{ - printf - ("- Peer requested OpenPGP certificate authentication.\n"); - - print_openpgp_info(state); - - break; - } - } + print_cert_info( state); print_cert_vrfy(state); @@ -271,6 +257,23 @@ int print_info(GNUTLS_STATE state) return 0; } +void print_cert_info(GNUTLS_STATE state) +{ + + printf( " - Certificate type: "); + switch (gnutls_cert_type_get(state)) { + case GNUTLS_CRT_X509: + printf("X.509\n"); + print_x509_info(state); + break; + case GNUTLS_CRT_OPENPGP: + printf("OpenPGP\n"); + print_openpgp_info(state); + break; + } + +} + void print_list(void) { /* FIXME: This is hard coded. Make it print all the supported @@ -286,10 +289,11 @@ void print_list(void) printf(", SSL3.0\n"); printf("Ciphers:"); - printf(" RIJNDAEL_128_CBC"); - printf(", TWOFISH_128_CBC"); - printf(", 3DES_CBC"); + printf(" RIJNDAEL-128-CBC"); + printf(", TWOFISH-128-CBC"); + printf(", 3DES-CBC"); printf(", ARCFOUR\n"); + printf(", ARCFOUR-40\n"); printf("MACs:"); printf(" MD5"); @@ -297,10 +301,11 @@ void print_list(void) printf("Key exchange algorithms:"); printf(" RSA"); - printf(", DHE_DSS"); - printf(", DHE_RSA"); + printf(", RSA-EXPORT"); + printf(", DHE-DSS"); + printf(", DHE-RSA"); printf(", SRP"); - printf(", ANON_DH\n"); + printf(", ANON-DH\n"); printf("Compression methods:"); printf(" ZLIB"); diff --git a/src/common.h b/src/common.h index f0e4652208..5c6f13154f 100644 --- a/src/common.h +++ b/src/common.h @@ -4,4 +4,5 @@ #include int print_info( GNUTLS_STATE state); +void print_cert_info( GNUTLS_STATE state); int print_list(void); diff --git a/src/tests.c b/src/tests.c index 3604de8ca3..1cf59d7a7b 100644 --- a/src/tests.c +++ b/src/tests.c @@ -25,6 +25,7 @@ #include #include #include +#include extern GNUTLS_SRP_CLIENT_CREDENTIALS srp_cred; extern GNUTLS_ANON_CLIENT_CREDENTIALS anon_cred; @@ -526,3 +527,24 @@ int tmp_session_id_size; return FAILED; } + +int test_certificate( GNUTLS_STATE state) { +int ret; + + ADD_ALL_CIPHERS(state); + ADD_ALL_COMP(state); + ADD_ALL_CERTTYPES(state); + ADD_ALL_PROTOCOLS(state); + ADD_ALL_MACS(state); + ADD_ALL_KX(state); + + gnutls_cred_set(state, GNUTLS_CRD_CERTIFICATE, xcred); + + ret = do_handshake( state); + if (ret < 0) return FAILED; + + printf("\n"); + print_cert_info( state); + + return SUCCEED; +} diff --git a/src/tests.h b/src/tests.h index d4f7bf4a78..9905625696 100644 --- a/src/tests.h +++ b/src/tests.h @@ -23,6 +23,7 @@ int test_anonymous( GNUTLS_STATE state); int test_unknown_ciphersuites( GNUTLS_STATE state); int test_openpgp1( GNUTLS_STATE state); int test_bye( GNUTLS_STATE state); +int test_certificate( GNUTLS_STATE state); int test_session_resume2( GNUTLS_STATE state); #define GERR(ret) fprintf(stderr, "*** Error: %s\n", gnutls_strerror(ret)) diff --git a/src/tls_test.c b/src/tls_test.c index 197a1e8836..2234f7abb2 100644 --- a/src/tls_test.c +++ b/src/tls_test.c @@ -79,6 +79,7 @@ typedef struct { static const TLS_TEST tls_tests[] = { { "for TLS 1.0 support", test_tls1, "yes", "no", "dunno" }, { "for SSL 3.0 support", test_ssl3, "yes", "no", "dunno" }, + { "for certificate information", test_certificate, "", "", "" }, { "for version rollback bug in RSA PMS", test_rsa_pms, "no", "yes", "dunno" }, { "for version rollback bug in Client Hello", test_version_rollback, "no", "yes", "dunno" }, /* this test will disable TLS 1.0 if the server is