Other Parts Discussed in Thread: CC3235SF
Hello,
I'm trying to setup the TI CC3235SF power measurement example on a LP-CC3235MOD kit.
I want to configure the python TCP server and the firmware example for current measurement when Always connected, TLS secured TCP socket connection.
I followed the instruction from https://www.ti.com/lit/an/swra594a/swra594a.pdf but I'm stuck with an SSL error. I know my connection works with unsecured TCP (when SOCKET_TYPE = SocketType_TCP), but I couldn't get the secured socket to work.
Here is the error output and the ssl_tcp_server.py file:
import socket, ssl TCP_PORT = 443 idx = 1 print ("-- Server is starting --") bindsocket = socket.socket() bindsocket.bind(('', TCP_PORT)) print ("-- SSL Server is set and listening on port ", str(TCP_PORT), " --") while True: print (" Waiting for client requests ... ") bindsocket.listen(1) (newsocket, fromaddr) = bindsocket.accept() # https://docs.python.org/3/library/ssl.html#ssl.wrap_socket # https://www.openssl.org/docs/man1.1.1/man1/ciphers.html connstream = ssl.wrap_socket(newsocket, server_side=True, certfile="cert.pem", keyfile="cert_privkey.pem" ) print ('Secured connection has been established with address: ', addr) while True: data = connstream.read() if not data : break elif data : print ("packet number: ", idx) idx += 1 connstream.close() print ("Connection is closed")
I can think of two potential causes:
1. Missing cert/key files on the CC3235 device to connect to the secured TCP socket? I'm not an expert just guess there may be something necessary but I don't see it in the example code.
2. Wrong cipher generation and the suite selection.
The example ask to config the fw example to:
uint32_t cipher = SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA;
uint8_t method = SL_SO_SEC_METHOD_TLSV1_2
However, there isn't any specific instruction on how to generate the server-side certificate and private key accordingly.