To secure communication between the gateway and your server, you will need SSL/TLS certificates. The most robust approach is to use a certificate signed by a trusted Certification Authority. However, for demonstration purposes, we will generate and use self-signed certificates.
Before you start
Ensure that OpenSSL is installed on your computer (it is included with Git, so you likely have it already).
Register a domain name and point it to the IP address of the server that will receive data from the gateway.
Set up
1
Generate a private key
Open the command line and navigate to the folder where OpenSSL is installed (e.g., Git\usr\bin). Then run:
opensslgenrsa-outrootCA.key2048
This command generates a 2048-bit private key and saves it in a file named rootCA.key in the current directory. This key will later be used to sign all certificates.
Your server application must support HTTPS communication. How you enable this depends on the programming language and framework you are using.
For example Python’s Flask framework supports HTTPS natively. Copy server.crt and server.key into your project folder, then update your app.run() call: