Site Search

Quectel Communication Module HTTPS Connection Guide

Introduction

This time, we will introduce an example of an evaluation procedure forHTTPS communication using Quectel's communication module.

This article does not cover procedures for powering on or connecting to the network via a carrier line.

(▶Please refer to our separate article for more details.)

Introduction of equipment used

Quectel UMTS & LTE EVB Kit (board, EG95-JP TE-A board, compatible antennas)

- USB cable (USB-A to micro B)

- Notebook PC (for connecting the evaluation kit and controlling with AT commands)

+ Compatible USB driver (please contact us to obtain it)

+ AT command tools (TeraTerm, Quectel's QCOM tool, etc.)

・NTT docomo 5G nano SIM card

Checking Network Connectivity

AT+CEREG?
+CEREG: 0,1
AT+CGATT? 
+CGATT: 1

+CEREG: 0,1: Indicates that the device is registered on the network.
+CGATT: 1: Attached to the network.

HTTPS communication procedure (responses up to "OK" for each command are omitted.)

Binding HTTP and SSL

AT+QHTTPCFG="contextid",1
AT+QHTTPCFG="sslctxid",1

It associates PDP and SSL context IDs with HTTP.

TLS settings and CA (Certificate Authority) certificate upload and activation

The following describes the steps to fix TLS to TLS1.2, upload the CA certificate to UFS (Universal Flash Storage), and enable it.

// TLSバージョン設定 AT+QSSLCFG="sslversion",1,3 // 3=TLS1.2 // セキュリティレベル設定 AT+QSSLCFG="seclevel",1,1 // 0=認証なし(証明書不要, 非推奨)、1=CA証明書のみ必須、2=CA証明書+クライアント証明書+秘密鍵が必須 // UFS内のファイル一覧と空き容量の確認 AT+QFLST // UFSのファイル一覧を表示 AT+QFLDS="UFS:" // UFSの空き容量を照会 // 不要ファイルを削除 AT+QFDEL="UFS:<File name>" // 指定ファイルを削除 // CA証明書をUFSにアップロード AT+QFUPL="UFS:cacert.pem",<BYTES>,10000 // UFSにCA証明書(<BYTES> バイト)を書き込み AT+QSSLCFG="cacert",1,"UFS:cacert.pem" // CA証明書を有効化

From uploading the client certificate and private key to activation

The following describes the procedure for uploading a client certificate and private key to UFS (Universal Flash Storage) and activating them.
AT+QFUPL="UFS:clientcert.pem",<BYTES>,10000 // クライアント証明書(<BYTES> バイト)を書き込み AT+QSSLCFG="clientcert",1,"UFS:clientcert.pem" // クライアント証明書を有効化 AT+QFUPL="UFS:clientkey.pem",<BYTES>,10000 // 秘密鍵(<BYTES> バイト)を書き込み AT+QSSLCFG="clientkey",1,"UFS:clientkey.pem" // 秘密鍵を有効化 // 環境に応じて暗号スイートを設定 AT+QSSLCFG="ciphersuite",1,0xFFFF // 例:1,0xFFFF=利用可能な暗号スイートをすべて選択

Check if the module time is different from the current time

// モジュール内の現在時刻を確認 AT+CCLK? // 時刻がずれている場合は、適切な現在時刻を設定 AT+CCLK="yyyy/mm/dd,hh:mm:ss+xx"

Because the certificate expiration date is checked, if the time in the module is significantly out of sync, a certificate error may occur.

From the start of HTTPS communication to the response of information in the URL

// URLの文字数(改行含む)とタイムアウト時間を指定 AT+QHTTPURL=xx,<timeout> CONNECT https://xxxxxxxx // アクセス先URLを入力 // HTTP GETの実行 AT+QHTTPGET=<timeout> // 例:<timeout>=タイムアウト時間[s] +QHTTPGET: 0,200,<BYTES> // 0:Operation successful,200:OK,<BYTES>:受信データのバイト数 // 受信データの読み出し AT+QHTTPREAD=<timeout> CONNECT <html> // URLのレスポンス内容 ... </html>
When specifying the number of characters in a URL, please note that line breaks are included in the number of characters.

in conclusion

If you are interested in the latest LPWA/LTE/5G communication modules based on the content of this article, please contact us.

Inquiry

For inquiries regarding Quectel products and communication modules, please visit the link below.

Quectel Manufacturer Information Top

To return to the Quectel manufacturer information top page, please click below.