diff options
Diffstat (limited to 'demos/ssl/cli.cpp')
-rw-r--r-- | demos/ssl/cli.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/demos/ssl/cli.cpp b/demos/ssl/cli.cpp index f15b7ad170..2efe161d43 100644 --- a/demos/ssl/cli.cpp +++ b/demos/ssl/cli.cpp @@ -1,6 +1,10 @@ /* cli.cpp - Minimal ssleay client for Unix 30.9.1996, Sampo Kellomaki <sampo@iki.fi> */ +/* mangled to work with SSLeay-0.9.0b and OpenSSL 0.9.2b + Simplified to be even more minimal + 12/98 - 4/99 Wade Scholine <wades@mail.cybg.com> */ + #include <stdio.h> #include <memory.h> #include <errno.h> @@ -17,6 +21,7 @@ #include <openssl/ssl.h> #include <openssl/err.h> + #define CHK_NULL(x) if ((x)==NULL) exit (1) #define CHK_ERR(err,s) if ((err)==-1) { perror(s); exit(1); } #define CHK_SSL(err) if ((err)==-1) { ERR_print_errors_fp(stderr); exit(2); } @@ -31,9 +36,14 @@ void main () X509* server_cert; char* str; char buf [4096]; + SSL_METHOD *meth; + SSLeay_add_ssl_algorithms(); + meth = SSLv2_client_method(); SSL_load_error_strings(); - ctx = SSL_CTX_new (); CHK_NULL(ctx); + ctx = SSL_CTX_new (meth); CHK_NULL(ctx); + + CHK_SSL(err); /* ----------------------------------------------- */ /* Create a socket and connect to server using normal socket calls. */ @@ -67,12 +77,12 @@ void main () server_cert = SSL_get_peer_certificate (ssl); CHK_NULL(server_cert); printf ("Server certificate:\n"); - str = X509_NAME_oneline (X509_get_subject_name (server_cert)); + str = X509_NAME_oneline (X509_get_subject_name (server_cert),0,0); CHK_NULL(str); printf ("\t subject: %s\n", str); Free (str); - str = X509_NAME_oneline (X509_get_issuer_name (server_cert)); + str = X509_NAME_oneline (X509_get_issuer_name (server_cert),0,0); CHK_NULL(str); printf ("\t issuer: %s\n", str); Free (str); |