---
title: "15-STM32+W5500 Basic Control (Self-built IoT Platform) - Porting mbedtls to enable STM32+W5500 to co"
url: "https://maker.wiznet.io/mark/projects/15-stm32-w5500-basic-control-self-built-iot-platform-porting-mbedtls-to-enable-stm32-w5500-to-co/"
markdown_url: "https://maker.wiznet.io/mark/projects/15-stm32-w5500-basic-control-self-built-iot-platform-porting-mbedtls-to-enable-stm32-w5500-to-co/md"
type: "UCC: User Created Content"
author: "杨奉武"
author_url: "https://www.cnblogs.com/yangfengwu/p/18370632"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "杨奉武"
original_url: "https://www.cnblogs.com/yangfengwu/p/18370632"
published: "2026-01-06"
language: "en"
likes: 0
views: 320
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# 15-STM32+W5500 Basic Control (Self-built IoT Platform) - Porting mbedtls to enable STM32+W5500 to co

> 15-STM32+W5500 Basic Control (Self-built IoT Platform) - Porting mbedtls to enable STM32+W5500 to connect to an MQTT server via SSL (verifying the server's CA c

Original author: 杨奉武 (source: https://www.cnblogs.com/yangfengwu/p/18370632)

## Article

### [15-STM32+W5500 Basic Control (Self-built IoT Platform) - Porting mbedtls to enable STM32+W5500 to connect to an MQTT server via SSL (verifying the server's CA certificate)](https://www.cnblogs.com/yangfengwu/p/18370632)

&lt;p>&lt;iframe name="ifd" src="https://mnifdv.cn/resource/cnblogs/STM32W5500AIR202A/" frameborder="0" scrolling="auto" width="100%" height="1500">&lt;/iframe>&lt;/p>

**illustrate**

### **Verifying the server certificate is to confirm that the server you are connecting to is indeed your own server;**

### **Some people set up fake base stations to impersonate servers, which can lead to information leaks once devices connect to them;**

### **During the SSL handshake process, the server sends the CA certificate to the device, which is pre-configured with this CA certificate.**

### **Then, during the handshake process between the device and the server, the CA certificate sent by the server can be compared with the local certificate;**

## **test**

### **1. Open the code in this section.**

![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724124%5F0%2Epng)

![](https://img2022.cnblogs.com/blog/819239/202206/819239-20220616181838380-1161422866.png)

### **2. The SSL port for MQTT is: 8883**

![](https://img2024.cnblogs.com/blog/819239/202408/819239-20240820235549135-2039945313.png)![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724125%5F0%2Epng)

### **3. Download the CA certificate from the server.**

#### **Users connecting to their own servers should replace their own certificate data.**

![](https://img2020.cnblogs.com/blog/819239/202104/819239-20210404003708555-1356018005.png)![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724124%2Epng)

![](https://img2024.cnblogs.com/blog/819239/202408/819239-20240820235748580-1430948865.png)![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724124%5F2%2Epng)

### **4. Put the certificate data into the microcontroller.**

![](https://img2024.cnblogs.com/blog/819239/202408/819239-20240820235933718-2051904932.png)![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724125%5F2%2Epng)

### **5. Compile and download to the development board (this can be done by checking the development board's serial port log).**

![](https://img2022.cnblogs.com/blog/819239/202201/819239-20220121110408260-1076841797.png)

![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724125%2Epng)

#### **A normal MQTT connection and communication indicates that everything is fine.**

![](https://img2024.cnblogs.com/blog/819239/202408/819239-20240821000208276-2023112898.png)![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724124%5F1%2Epng)

### **6. Then you can modify the certificate, deleting some parts.**

![](https://img2024.cnblogs.com/blog/819239/202408/819239-20240821000615440-149648478.png)![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724124%5F4%2Epng)

### **7. Recompile, download, and test (it will print that there was a problem with the certificate sent by the server during the SSL handshake process).**

![](https://img2024.cnblogs.com/blog/819239/202408/819239-20240821000741424-1825422282.png)![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724124%5F5%2Epng)

## **Program Description**

### **1. This program is an addition to the previous section, which did not verify certificates (loading the CA certificate).**

![](https://img2024.cnblogs.com/blog/819239/202408/819239-20240821001102282-2030114456.png)

![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724125%5F1%2Epng)

### **2. The verification method is to verify the server certificate.**

![](https://img2024.cnblogs.com/blog/819239/202408/819239-20240821001147203-902035246.png)![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724124%5F6%2Epng)

### **3. Obtain the certificate verification result**

![](https://img2024.cnblogs.com/blog/819239/202408/819239-20240821001222438-757119535.png)![](https://maker.wiznet.io/upload/ckeditor5/647238656%5F1767724124%5F3%2Epng)

---

Source: https://maker.wiznet.io/mark/projects/15-stm32-w5500-basic-control-self-built-iot-platform-porting-mbedtls-to-enable-stm32-w5500-to-co/
