]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Improved the gnutls-cli-debug program
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 26 Aug 2002 10:13:15 +0000 (10:13 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 26 Aug 2002 10:13:15 +0000 (10:13 +0000)
src/Makefile.am
src/common.c
src/common.h
src/tests.c
src/tests.h
src/tls_test.c

index 687f6c9ba9e4969272d3765cc4295a5ca51f3e05..aa5e757a61f13c1aa969f273273a0ace4f4b70f2 100644 (file)
@@ -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)
 
 
index 6f7eadf8f527f4d2a9a57dff843d3b7e5f1abd0d..4f0fbc54c0c4285c1de10bfbadd025ad31540b6e 100644 (file)
@@ -3,6 +3,8 @@
 #include <gnutls/extra.h>
 #include <time.h>
 
+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");
index f0e46522080c05f154f2f7c25c55abfc0abf58d4..5c6f13154ff230f99a717aea097601b2b9f755b3 100644 (file)
@@ -4,4 +4,5 @@
 #include <gnutls/gnutls.h>
 
 int print_info( GNUTLS_STATE state);
+void print_cert_info( GNUTLS_STATE state);
 int print_list(void);
index 3604de8ca30131e2c32c8aee554b28f0e05f9f76..1cf59d7a7b609754661fccd78d064c34346076ad 100644 (file)
@@ -25,6 +25,7 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h>
+#include <common.h>
 
 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;
+}
index d4f7bf4a78205ae85eff8e60fdf9544949045c54..9905625696c6db0cf4cec3b346fdd2ac423803b3 100644 (file)
@@ -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))
index 197a1e883686e7dc5429ad8fbf398d3a138864d9..2234f7abb26447a4d59541632a22477636156f4c 100644 (file)
@@ -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