SIM82XX - SIM83XX Series - SSL - Application Note - V1.01
SIM82XX - SIM83XX Series - SSL - Application Note - V1.01
_SSL_Application Note
5G Module
GENERAL NOTES
COPYRIGHT
www.simcom.com 2 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
About Document
Version History
Scope
This document applies to the SIMCom SIM820X series, SIM821X series, SIM826X series and SIM83XX
series.
www.simcom.com 3 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
Contents
About Document............................................................................................................ 3
Version History.........................................................................................................................................................3
Scope........................................................................................................................................................................ 3
Contents........................................................................................................................... 4
1 Introduction............................................................................................................... 5
1.1 Purpose of the document...........................................................................................................................5
1.2 Related documents.....................................................................................................................................5
1.3 Conventions and abbreviations................................................................................................................ 5
2 SSL Introduction...................................................................................................... 6
2.1 Characteristic............................................................................................................................................... 6
2.2 SSL Context Configuration........................................................................................................................ 6
2.3 SSL Commands Process...........................................................................................................................7
4 Bearer Configuration.............................................................................................. 9
5 SSL Examples.........................................................................................................10
5.1 Access to TCP server...............................................................................................................................10
5.2 Access to SSL/TLS server (not verify server and client)....................................................................11
5.3 Access to SSL/TLS server (only verify the server)............................................................................. 13
5.4 Access to SSL/TLS server (verify server and client).......................................................................... 15
5.5 Access to SSL/TLS server (only verify the client)............................................................................... 18
5.6 Access to SSL/TLS server in transparent mode................................................................................. 20
5.7 Download certificate into module........................................................................................................... 22
www.simcom.com 4 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
1 Introduction
Based on module AT command manual, this document will introduce SSL application process.
Developers could understand and develop application quickly and efficiently based on this document.
www.simcom.com 5 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
2 SSL Introduction
SSL feature includes SSL (Secure Socket Layer) and TLS (Transport Layer Security). It is used to transport
encrypted data based on TCP/IP protocol and SSL/TLS protocol. SSL/TLS usually works between
Transport Layer and Application Layer.
2.1 Characteristic
Unencrypted Connections
Module works as TCP clients. It exchanges unencrypted data with TCP servers by TCP
connections.
Encrypted Connections
Module works as SSL clients. It exchanges encrypted data with SSL servers by TCP connections.
www.simcom.com 6 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
AT+CSSLCFG="ignorlocaltime",<ssl_ctx_index>,<ignoreltime>.
AT+CSSLCFG="negotiatetime",<ssl_ctx_index>,<negotiatetime>.
Step 1: Ensure GPRS network is available before performing SSL related operations.
Step 5: Set the SSL context used in SSL connection by AT+CCHSSLCFG (if connect to SSL/TLS server).
Step 10: Deactivate the PDP context to stop SSL service by AT+CCHSTOP.
www.simcom.com 7 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
Command Description
AT+CCHSTART Start SSL Service
AT+CCHSTOP Stop SSL Service
AT+CCHOPEN Setup SSL Client Socket Connections
AT+CCHCLOSE Destroy SSL Client Socket Connections
AT+CCHSEND Send SSL Data
AT+CCHRECV Retrieve SSL Buffer Data
AT+CCHADDR Get IP Address of PDP Context
AT+CCHSSLCFG Set SSL Context Index of SSL Connections
AT+CCHCFG Set Context of SSL Connections
AT+CCHSET Set Mode of Sending and Receiving SSL Data
AT+CSSLCFG Configure SSL Context
AT+CCERTDOWN Download Certificate Files into Module
AT+CCERTDELE Delete Certificate Files of Module
AT+CCERTLIST List Certificate Files of Module
For detail information, please refer to " SIM82XX_SIM83XX Series_AT Command Manual".
www.simcom.com 8 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
4 Bearer Configuration
Make sure that the module has been attached to network and APN has been configured before starting SSL
service.
AT+CPIN?
+CPIN: READY // Check Status of SIM Card
OK
AT+CSQ
+CSQ: 27,99 // Check RF Signal
OK
AT+CGREG?
+CGREG: 0,1 // Check Status of PS Service
OK
AT+CEREG?
+CEREG: 0,1
OK
AT+CPSI?
+CPSI:
LTE,Online,460-00,0x1816,27593490,295,EUTR
AN-BAND3,1300,5,5,-98,-738,-440,8
+CPSI:
// Check Information of Network
NR5G_NSA,210,NR5G_BAND41,504990,-1000,-
140,55
OK
AT+CGDCONT=1, "IP", "CMNET" // Set PDP Context Information
OK
AT+CGDCONT?
+CGDCONT:
1,"IPV4","CMNET","0.0.0.0.0.0.0.0.0.0.0.0.0.0.0. // Check Information of PDP Context
0",0,0,0,0
OK
www.simcom.com 9 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
5 SSL Examples
+CCHSTART: 0
AT+CCHOPEN=0,"www.baidu.com",80,1 // connect to TCP server
OK
+CCHOPEN: 0,0
AT+CCHSEND=0,121 // send data to server
>GET / HTTP/1.1
Host: www.baidu.com
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0)
Gecko/20100101 Firefox/4.0
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q
=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Cookie:
BAIDUID=D6F6D0D297CCAE39BD45C683996696C7:F
G=1;
Hm_lvt_9f14aaa038bbba8b12ec2a4a3e51d254=1321597
443439;
USERID=e194072f4759c0f7c2b6e5d3b09298984fd1
OK
+CCHSEND: 0,0
+CCHRECV: DATA,0,757 // report the received data from server
www.simcom.com 10 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>7a367f7b87705e16b985e34ca59b8ae8b1
d28d47
Time : Tue Aug 21 10:55:16 CST 2018</center>
</body>
</html>
AT+CCHCLOSE=0 // Disconnect from the Service
OK
+CCHCLOSE: 0,0
AT+CCHSTOP // stop SSL Service
OK
+CCHSTOP: 0
Following commands shows how to access to a SSL/TLS server without verifying the server. It needs to
configure the authentication mode to 0, and then it will connect to the server successfully.
www.simcom.com 11 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
+CCHSTART: 0
// Set the first SSL context to be used in the
AT+CCHSSLCFG=0,0
// SSL connection
OK
AT+CCHOPEN=0,"www.baidu.com", 443,2 // connect to SSL/TLS server
OK
+CCHOPEN: 0,0
AT+CCHSEND=0,121 // send data to server
>GET / HTTP/1.1
Host: www.baidu.com
User-Agent: MAUI htp User Agent
Proxy-Connection: keep-alive
Content-Length: 0
OK
+CCHSEND: 0,0
www.simcom.com 12 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
<html>
<head>
<script>
location.replace(location.href.replace("https:/
/","http://"));
</script>
</head>
<body>
<noscript><meta http-equiv="refresh"
content="0;url=http://www.baidu.com/"></noscrip
t>
</body>
</html>
AT+CCHCLOSE=0 // Disconnect from the Service
OK
+CCHCLOSE: 0,0
AT+CCHSTOP // stop SSL Service
OK
+CCHSTOP: 0
Following commands shows how to access to a SSL/TLS server with verifying the server. It needs to
configure the authentication mode to 1 and the right server root CA, and then it will connect to the server
successfully.
www.simcom.com 13 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
+CCHSTART: 0
// Set the first SSL context to be used in the SSL
AT+CCHSSLCFG=0,0
// connection
OK
AT+CCHOPEN=0,"www.baidu.com",443,2 // connect to SSL/TLS server
OK
+CCHOPEN: 0,0
AT+CCHSEND=0,121 // send data to server
>GET / HTTP/1.1
Host: www.baidu.com
User-Agent: MAUI htp User Agent
Proxy-Connection: keep-alive
Content-Length: 0
OK
+CCHSEND: 0,0
www.simcom.com 14 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
P3p: CP=" OTI DSP COR IVA OUR IND COM "
Pragma: no-cache
Server: BWS/1.1
Set-Cookie: BD_NOT_HTTPS=1; path=/;
Max-Age=300
Set-Cookie:
BIDUPSID=D95046B2B3D5455BF01A622DB8DE
D9EA; expires=Thu, 31-Dec-37 23:55:55 GMT;
max-age=2147483647; path=/;
domain=.baidu.com
Set-Cookie: PSTM=1536042095; expires=Thu,
31-Dec-37 23:55:55 GMT; max-age=2147483647;
path=/; domain=.baidu.com
Strict-Transport-Security: max-age=0
X-Ua-Compatible: IE=Edge,chrome=1
<html>
<head>
<script>
location.replace(location.href.replace("https
://","http://"));
</script>
</head>
<body>
<noscript><meta http-equiv="refresh"
content="0;url=http://www.baidu.com/"></noscri
pt>
</body>
</html>
AT+CCHCLOSE=0 // Disconnect from the Service
OK
+CCHCLOSE: 0,0
AT+CCHSTOP // stop SSL Service
OK
+CCHSTOP: 0
www.simcom.com 15 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
Following commands shows how to access to a SSL/TLS server with verifying the server and client. It
needs to configure the authentication mode to 2, the right server root CA, the right client certificate and key,
and then it will connect to the server successfully.
+CCHSTART: 0
// Set the first SSL context to be used in the SSL
AT+CCHSSLCFG=0,0
// connection
OK
AT+CCHOPEN=0,"www.baidu.com",443,2 // connect to SSL/TLS server
OK
+CCHOPEN: 0,0
AT+CCHSEND=0,121 // send data to server
>GET / HTTP/1.1
Host: www.baidu.com
User-Agent: MAUI htp User Agent
Proxy-Connection: keep-alive
Content-Length: 0
OK
+CCHSEND: 0,0
www.simcom.com 16 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
Cache-Control: no-cache
Connection: Keep-Alive
Content-Length: 227
Content-Type: text/html
Date: Tue, 04 Sep 2018 06:21:35 GMT
Etag: "5b7b7f40-e3"
Last-Modified: Tue, 21 Aug 2018 02:56:00 GMT
P3p: CP=" OTI DSP COR IVA OUR IND COM "
Pragma: no-cache
Server: BWS/1.1
Set-Cookie: BD_NOT_HTTPS=1; path=/;
Max-Age=300
Set-Cookie:
BIDUPSID=D95046B2B3D5455BF01A622DB8DE
D9EA; expires=Thu, 31-Dec-37 23:55:55 GMT;
max-age=2147483647; path=/;
domain=.baidu.com
Set-Cookie: PSTM=1536042095; expires=Thu,
31-Dec-37 23:55:55 GMT; max-age=2147483647;
path=/; domain=.baidu.com
Strict-Transport-Security: max-age=0
X-Ua-Compatible: IE=Edge,chrome=1
<html>
<head>
<script>
location.replace(location.href.replace("https
://","http://"));
</script>
</head>
<body>
<noscript><meta http-equiv="refresh"
content="0;url=http://www.baidu.com/"></noscri
pt>
</body>
</html>
AT+CCHCLOSE=0 // Disconnect from the Service
OK
+CCHCLOSE: 0,0
AT+CCHSTOP // stop SSL Service
OK
+CCHSTOP: 0
www.simcom.com 17 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
Following commands shows how to access to a SSL/TLS server with verifying the client. It needs to
configure the authentication mode to 3, the right client certificate and key, and then it will connect to the
server successfully.
+CCHSTART: 0
// Set the first SSL context to be used in the SSL
AT+CCHSSLCFG=0,0
// connection
OK
AT+CCHOPEN=0,"www.baidu.com",443,2 // connect to SSL/TLS server
OK
+CCHOPEN: 0,0
AT+CCHSEND=0,121 // send data to server
>GET / HTTP/1.1
Host: www.baidu.com
User-Agent: MAUI htp User Agent
Proxy-Connection: keep-alive
Content-Length: 0
OK
www.simcom.com 18 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
+CCHSEND: 0,0
<html>
<head>
<script>
location.replace(location.href.replace("https
://","http://"));
</script>
</head>
<body>
<noscript><meta http-equiv="refresh"
content="0;url=http://www.baidu.com/"></noscri
pt>
</body>
</html>
AT+CCHCLOSE=0 // Disconnect from the Service
OK
www.simcom.com 19 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
+CCHCLOSE: 0,0
AT+CCHSTOP // stop SSL Service
OK
+CCHSTOP: 0
Following commands shows how to access to a SSL/TLS server with not verifying the server in transparent
mode. It needs to configure the sending and receiving mode to 1(the transparent mode).
Only the session 0 is support the transparent mode.
+CCHSTART: 0
// Set the first SSL context to be used in the SSL
AT+CCHSSLCFG=0,0
// connection
OK
AT+CCHOPEN=0, "www.baidu.com",443,2 // connect to SSL/TLS server
CONNECT 115200
GET / HTTP/1.1
Host: www.baidu.com
User-Agent: MAUI htp User Agent
Proxy-Connection: keep-alive // send data to server
Content-Length: 0
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: no-cache
Connection: Keep-Alive
// report the received data from server
Content-Length: 227
Content-Type: text/html
Date: Tue, 04 Sep 2018 06:26:03 GMT
Etag: "5b7b7f40-e3"
www.simcom.com 20 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
<html>
<head>
<script>
location.replace(location.href.replace("https
://","http://"));
</script>
</head>
<body>
<noscript><meta http-equiv="refresh"
content="0;url=http://www.baidu.com/"></noscri
pt>
</body>
</html>
+++ // switch to command mode
OK
AT+CCHCLOSE=0 // Disconnect from the Service
OK
CLOSED
AT+CCHSTOP // stop SSL Service
OK
+CCHSTOP: 0
www.simcom.com 21 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
www.simcom.com 22 / 24
SIM82XX_SIM83XX Series_SSL_Application Note_V1.01
FqY88arQFwFSz8HfIe0r6QKBgCbQLtTdzKzqJdt8+6cw
QFYg+9O59MJGVVefNskp
chhzVfAX0n9Tl5Lq9fMJ5FX4g+3JGargjfWuGCTTFBk0
TM2t4wde7AmwiiivU5LU
T2Afo6pLTKrSE9k+yX2iug+O156VfsbIeAm/Ng5RCJ91J
CvFgULro6/axNmnWORf
9rK7AoGBAIK4edrX1MjerCsLu3y9Dy4pAx6ER6ei4xpk
O25U8wUcqqc+YD2m2xlA
DjqROITeaxXkmPIyRKAXVarhk8LmXT/oDFUAPsTqUZ
9LBrviqtMi+G2OFPbdKDwe
ZBNAgwFpFlUVoi0UYnZF8rBq0tepqivrayEWdKKfMMJj
q+l72SxD
-----END RSA PRIVATE KEY-----
OK
AT+CCERTDOWN={non-ascii}"262378344532443B26 // download file with not ASCII coding file
2378353334453B2E70656D",1918 // name
>-----BEGIN CERTIFICATE-----
MIIFRDCCAyygAwIBAgIIZmPau7FelQswDQYJKoZIhvc
NAQELBQAwQDELMAkGA1UE
BhMCU0kxGzAZBgNVBAoMEnN0YXRlLWluc3RpdHV0
aW9uczEUMBIGA1UEAwwLVGF4
IENBIFRlc3QwHhcNMTUwNzIz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Ayqe3aq88GG7rCyxROGH
BPcakfMmhx1cLYdcY5ATXL/n67eo+S+1g7e/sK3fVXav
5qWs9oUEhAOgcOACMohu
JlBbMq2Qp8lxdpiRWCcyiY1vGQcHcZ02oey/c06fBZE4i
qJdYAhYhsBB5H+idtwJ
s6Lade4wqG58hWCNKBxU+KWDckGGX5CxsfU7gdYgj
yKq0ow60qQWi4H8pD+WO1Bn
rvISkAT7vMk2BOz+YlCKZmuq0h3PCkK5T6xA01fUZCa
eze0RozFaekDBEHK0bc1D
My3SKbB3cjdcMzmV8sVdxnNOTxlrP7+BinctxT3q3Va9
6kTmwI5pD0x6KOwC7Urr
53ubhI3U2XBAzkk14lDLU+7tqBqhDWwIMN0NyW1MR
TF8JB9Rz+4yCcDWMOT/FZg7
C60RrcnaO/0GETDz6XI6zedBXo1Q/rJTtXMOr8iVnc+jo
ZyO2ImOuTwP3C7M3Bnp
gFHqDtD48n9PV9prhbD4fYPyMe/3rshtBcpGAy2cGjpsP
28pkvP8lwBaP8pnpxvQ
7d3oiCBzznaOHjhm8+8C53b/1txzj/LP/4ZzIynsOhxy4cih
EPhAg1MKUY9qnbw9
9Q6EKrCSqk3TPqiWrTtu4pxyiEiquCHk8n+HX5cVhxUk
aEShdx4bjgvKB7JRF2T2
ST1lrKEM2DY=
-----END CERTIFICATE-----
OK
AT+CCERTLIST // list certificate files
+CCERTLIST: "中华.pem"
+CCERTLIST: "client_key.der"
OK
www.simcom.com 24 / 24