6 print "Trying to connect to the echo server..."
9 #cyassl.CyaSSL_Debugging_ON()
10 ctx = cyassl.CyaSSL_CTX_new(cyassl.CyaTLSv1_client_method())
12 print "Couldn't get SSL CTX for TLSv1"
15 ret = cyassl.CyaSSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None)
16 if ret != cyassl.SSL_SUCCESS:
17 print "Couldn't do SSL_CTX_load_verify_locations "
18 print "error string = ", ret
21 ssl = cyassl.CyaSSL_new(ctx)
22 ret = cyassl.CyaSSL_swig_connect(ssl, "localhost", 11111)
24 if ret != cyassl.SSL_SUCCESS:
25 print "Couldn't do SSL connect"
26 err = cyassl.CyaSSL_get_error(ssl, 0)
27 print "error string = ", cyassl.CyaSSL_error_string(err)
31 written = cyassl.CyaSSL_write(ssl, "hello from python\r\n", 19)
34 print "Wrote ", written, " bytes"
36 byteArray = cyassl.byteArray(100)
37 readBytes = cyassl.CyaSSL_read(ssl, byteArray, 100)
39 print "server reply: ", cyassl.cdata(byteArray, readBytes)