mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 01:58:32 -04:00
Rename the CyaSSL directory to WolfSSL
This commit is contained in:
parent
1b010fbaa7
commit
8af1ad9bac
391 changed files with 0 additions and 0 deletions
40
FreeRTOS-Plus/Source/WolfSSL/swig/runme.py
Normal file
40
FreeRTOS-Plus/Source/WolfSSL/swig/runme.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
# file: runme.py
|
||||
|
||||
import cyassl
|
||||
|
||||
print ""
|
||||
print "Trying to connect to the echo server..."
|
||||
|
||||
cyassl.CyaSSL_Init()
|
||||
#cyassl.CyaSSL_Debugging_ON()
|
||||
ctx = cyassl.CyaSSL_CTX_new(cyassl.CyaTLSv1_client_method())
|
||||
if ctx == None:
|
||||
print "Couldn't get SSL CTX for TLSv1"
|
||||
exit(-1)
|
||||
|
||||
ret = cyassl.CyaSSL_CTX_load_verify_locations(ctx, "../certs/ca-cert.pem", None)
|
||||
if ret != cyassl.SSL_SUCCESS:
|
||||
print "Couldn't do SSL_CTX_load_verify_locations "
|
||||
print "error string = ", ret
|
||||
exit(-1)
|
||||
|
||||
ssl = cyassl.CyaSSL_new(ctx)
|
||||
ret = cyassl.CyaSSL_swig_connect(ssl, "localhost", 11111)
|
||||
|
||||
if ret != cyassl.SSL_SUCCESS:
|
||||
print "Couldn't do SSL connect"
|
||||
err = cyassl.CyaSSL_get_error(ssl, 0)
|
||||
print "error string = ", cyassl.CyaSSL_error_string(err)
|
||||
exit(-1)
|
||||
|
||||
print "...Connected"
|
||||
written = cyassl.CyaSSL_write(ssl, "hello from python\r\n", 19)
|
||||
|
||||
if written > 0:
|
||||
print "Wrote ", written, " bytes"
|
||||
|
||||
byteArray = cyassl.byteArray(100)
|
||||
readBytes = cyassl.CyaSSL_read(ssl, byteArray, 100)
|
||||
|
||||
print "server reply: ", cyassl.cdata(byteArray, readBytes)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue