update python example to TLSv1.2 against example server

This commit is contained in:
toddouska
2015-05-03 10:19:02 -07:00
parent 6db33051d3
commit 1571ced095
3 changed files with 11 additions and 8 deletions

View File

@ -16,14 +16,14 @@ Please send questions to support@wolfssl.com
sudo make install sudo make install
2) start the example echoserver from the root directory 2) start the example server from the root directory
./examples/echoserver/echoserver ./examples/server/server -d
3) run ./PythonBuild.sh from this directory it will 3) run ./PythonBuild.sh from this directory it will
a) build the swig wrapper file a) build the swig wrapper file
b) compile the swig wrapper and wolfssl wrapper files b) compile the swig wrapper and wolfssl wrapper files
c) place them into a wolfssl shared library for python c) place them into a wolfssl shared library for python
d) run runme.py which will connect to the wolfSSL echo server, write a d) run runme.py which will connect to the wolfSSL server, write a
string, then read the result and output it string, then read the result and output it

View File

@ -3,13 +3,13 @@
import wolfssl import wolfssl
print "" print ""
print "Trying to connect to the echo server..." print "Trying to connect to the example server -d..."
wolfssl.wolfSSL_Init() wolfssl.wolfSSL_Init()
#wolfssl.wolfSSL_Debugging_ON() #wolfssl.wolfSSL_Debugging_ON()
ctx = wolfssl.wolfSSL_CTX_new(wolfssl.wolfTLSv1_client_method()) ctx = wolfssl.wolfSSL_CTX_new(wolfssl.wolfTLSv1_2_client_method())
if ctx == None: if ctx == None:
print "Couldn't get SSL CTX for TLSv1" print "Couldn't get SSL CTX for TLSv1.2"
exit(-1) exit(-1)
ret = wolfssl.wolfSSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None) ret = wolfssl.wolfSSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None)
@ -24,7 +24,10 @@ ret = wolfssl.wolfSSL_swig_connect(ssl, "localhost", 11111)
if ret != wolfssl.SSL_SUCCESS: if ret != wolfssl.SSL_SUCCESS:
print "Couldn't do SSL connect" print "Couldn't do SSL connect"
err = wolfssl.wolfSSL_get_error(ssl, 0) err = wolfssl.wolfSSL_get_error(ssl, 0)
print "error string = ", wolfssl.wolfSSL_error_string(err) if ret == -2:
print "tcp error, is example server running?"
else:
print "error string = ", wolfssl.wolfSSL_error_string(err)
exit(-1) exit(-1)
print "...Connected" print "...Connected"

View File

@ -33,7 +33,7 @@
%} %}
WOLFSSL_METHOD* wolfTLSv1_client_method(void); WOLFSSL_METHOD* wolfTLSv1_2_client_method(void);
WOLFSSL_CTX* wolfSSL_CTX_new(WOLFSSL_METHOD*); WOLFSSL_CTX* wolfSSL_CTX_new(WOLFSSL_METHOD*);
int wolfSSL_CTX_load_verify_locations(WOLFSSL_CTX*, const char*, const char*); int wolfSSL_CTX_load_verify_locations(WOLFSSL_CTX*, const char*, const char*);
WOLFSSL* wolfSSL_new(WOLFSSL_CTX*); WOLFSSL* wolfSSL_new(WOLFSSL_CTX*);