Quectel BG96 SSL AT Commands Manual V1.0

Quectel_BG96_SSL_AT_Commands_Manual_V1.0

Quectel_BG96_SSL_AT_Commands_Manual_V1.0

Quectel_BG96_SSL_AT_Commands_Manual_V1.0

Quectel_BG96_SSL_AT_Commands_Manual_V1.0

Quectel_BG96_SSL_AT_Commands_Manual_V1.0

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 28

DownloadQuectel BG96 SSL AT Commands Manual V1.0
Open PDF In BrowserView PDF
BG96 SSL
AT Commands Manual
LTE Module Series
Rev. BG96_SSL_AT_Commands_Manual_V1.0
Date: 2017-11-07

www.quectel.com

LTE Module Series
BG96 SSL AT Commands Manual

Our aim is to provide customers with timely and comprehensive service. For any
assistance, please contact our company headquarters:
Quectel Wireless Solutions Co., Ltd.
7th Floor, Hongye Building, No.1801 Hongmei Road, Xuhui District, Shanghai 200233, China
Tel: +86 21 5108 6236
Email: info@quectel.com

Or our local office. For more information, please visit:

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

http://quectel.com/support/sales.htm

For technical support, or to report documentation errors, please visit:
http://quectel.com/support/technical.htm
Or email to: support@quectel.com

GENERAL NOTES

QUECTEL OFFERS THE INFORMATION AS A SERVICE TO ITS CUSTOMERS. THE INFORMATION
PROVIDED IS BASED UPON CUSTOMERS’ REQUIREMENTS. QUECTEL MAKES EVERY EFFORT
TO ENSURE THE QUALITY OF THE INFORMATION IT MAKES AVAILABLE. QUECTEL DOES NOT
MAKE ANY WARRANTY AS TO THE INFORMATION CONTAINED HEREIN, AND DOES NOT ACCEPT
ANY LIABILITY FOR ANY INJURY, LOSS OR DAMAGE OF ANY KIND INCURRED BY USE OF OR
RELIANCE UPON THE INFORMATION. ALL INFORMATION SUPPLIED HEREIN IS SUBJECT TO
CHANGE WITHOUT PRIOR NOTICE.

COPYRIGHT

THE INFORMATION CONTAINED HERE IS PROPRIETARY TECHNICAL INFORMATION OF
QUECTEL WIRELESS SOLUTIONS CO., LTD. TRANSMITTING, REPRODUCTION, DISSEMINATION
AND EDITING OF THIS DOCUMENT AS WELL AS UTILIZATION OF THE CONTENT ARE
FORBIDDEN WITHOUT PERMISSION. OFFENDERS WILL BE HELD LIABLE FOR PAYMENT OF
DAMAGES. ALL RIGHTS ARE RESERVED IN THE EVENT OF A PATENT GRANT OR
REGISTRATION OF A UTILITY MODEL OR DESIGN.

Copyright © Quectel Wireless Solutions Co., Ltd. 2017. All rights reserved.

BG96_SSL_AT_Commands_Manual

Confidential / Released

1 / 27

LTE Module Series
BG96 SSL AT Commands Manual

About the Document
History
Revision
1.0

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Date

Author

Description

2017-11-07

Sherlock ZHAO/
Parker ZHOU

Initial

BG96_SSL_AT_Commands_Manual

Confidential / Released

2 / 27

LTE Module Series
BG96 SSL AT Commands Manual

Contents
About the Document ................................................................................................................................... 2
Contents ....................................................................................................................................................... 3
Table Index ................................................................................................................................................... 5
1

Introduction .......................................................................................................................................... 6
1.1. SSL Version and Cipher Suite .................................................................................................... 6
1.2. The Process of Using SSL Function ........................................................................................... 7
1.3. Description of Data Access Modes ............................................................................................. 8
1.4. Validity Check for Certificate ....................................................................................................... 9

2

Description of SSL AT Commands .................................................................................................. 10
2.1. Description of AT Commands ................................................................................................... 10
2.1.1. AT+QSSLCFG Configure Parameters of an SSL Context .......................................... 10
2.1.2. AT+QSSLOPEN Open an SSL Socket to Connect a Remote Server ........................ 14
2.1.3. AT+QSSLSEND Send Data via SSL Connection........................................................ 15
2.1.4. AT+QSSLRECV Receive Data via SSL Connection ................................................... 16
2.1.5. AT+QSSLCLOSE Close an SSL Connection .............................................................. 17
2.1.6. AT+QSSLSTATE Query the State of SSL Connection ................................................ 17
2.2. Description of URC ................................................................................................................... 18
2.2.1. Notify Received Data ..................................................................................................... 18
2.2.2. Notify Abnormal Close.................................................................................................... 19

3

Examples ............................................................................................................................................ 20
3.1. Configure and Activate a PDP Context ..................................................................................... 20
3.1.1. Configure a PDP Context ............................................................................................... 20
3.1.2. Activate a PDP Context.................................................................................................. 20
3.1.3. Deactivate a PDP Context ............................................................................................. 20
3.2. Configure an SSL Context ........................................................................................................ 20
3.3. SSL Client Works in Buffer Access Mode ................................................................................. 21
3.3.1. Set up an SSL Connection and Enter into Buffer Access Mode .................................... 21
3.3.2. Send Data in Buffer Access Mode ................................................................................. 21
3.3.3. Receive Data in Buffer Access Mode............................................................................. 21
3.3.4. Close an SSL Connection .............................................................................................. 22
3.4. SSL Client Works in Direct Push Mode .................................................................................... 22
3.4.1. Set up an SSL Connection and Enter into Direct Push Mode ....................................... 22
3.4.2. Send Data in Direct Push Mode..................................................................................... 22
3.4.3. Receive Data in Direct Push Mode ................................................................................ 22
3.4.4. Close an SSL Connection .............................................................................................. 22
3.5. SSL Client Works in Transparent Access Mode ....................................................................... 23
3.5.1. Set up an SSL Connection and Send Data in Transparent Access Mode..................... 23
3.5.2. Set up an SSL Connection and Receive Data in Transparent Access Mode ................ 23
3.5.3. Close an SSL Connection .............................................................................................. 23

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

BG96_SSL_AT_Commands_Manual

Confidential / Released

3 / 27

LTE Module Series
BG96 SSL AT Commands Manual

4

Error Handling .................................................................................................................................... 24
4.1. Open SSL Connection Fails ...................................................................................................... 24

5
6

Summary of Error Codes .................................................................................................................. 25
Appendix A References..................................................................................................................... 27

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
BG96_SSL_AT_Commands_Manual

Confidential / Released

4 / 27

LTE Module Series
BG96 SSL AT Commands Manual

Table Index
TABLE 1: SSL VERSIONS .................................................................................................................................. 6
TABLE 2: SUPPORTED SSL CIPHER SUITES .................................................................................................. 6
TABLE 3: SUMMARY OF ERROR CODES ...................................................................................................... 25
TABLE 4: RELATED DOCUMENTS .................................................................................................................. 27
TABLE 5: TERMS AND ABBREVIATIONS ........................................................................................................ 27

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
BG96_SSL_AT_Commands_Manual

Confidential / Released

5 / 27

LTE Module Series
BG96 SSL AT Commands Manual

1

Introduction

This document describes how to use the SSL functionality of Quectel BG96 module. In some cases, in
order to ensure communication privacy, the communication between the server and the client should be in
an encrypted way. So that it can prevent data from eavesdropping, tampering, or forging during the
communication process. The SSL function meets these demands.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

1.1. SSL Version and Cipher Suite
The following SSL versions are supported.

Table 1: SSL Versions
SSL Version
SSL3.0
TLS1.2
TLS1.1
TLS1.0

The following table shows SSL cipher suites supported by Quectel BG96 module. For detailed description
of cipher suites, please refer to RFC 2246-The TLS Protocol Version 1.0.

Table 2: Supported SSL Cipher Suites
Code of Cipher Suites

Name of Cipher Suites

0X0035

TLS_RSA_WITH_AES_256_CBC_SHA

0X002F

TLS_RSA_WITH_AES_128_CBC_SHA

0X0005

TLS_RSA_WITH_RC4_128_SHA

BG96_SSL_AT_Commands_Manual

Confidential / Released

6 / 27

LTE Module Series
BG96 SSL AT Commands Manual

0X0004

TLS_RSA_WITH_RC4_128_MD5

0X000A

TLS_RSA_WITH_3DES_EDE_CBC_SHA

0X003D

TLS_RSA_WITH_AES_256_CBC_SHA256

0XC011

TLS_ECDHE_RSA_WITH_RC4_128_SHA

0XC012

TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA

0XC013

TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA

0XC014
0XC027
0XC028
0XC02F
0XFFFF

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA

TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384

TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
Support all cipher suites above

1.2. The Process of Using SSL Function

Step 1: Configure , ,  and other parameters of a PDP context by
AT+QICSGP. Please refer to Quectel_BG96_TCP(IP)_AT_Commands_Manual for details.
Step 2: Activate the PDP context by AT+QIACT, then the assigned IP address can be queried by
AT+QIACT?. Please refer to Quectel_BG96_TCP(IP)_AT_Commands_Manual for details.
Step 3: Configure the SSL version, cipher suite, path of trusted CA certificate and the security level for
the specified SSL context by AT+QSSLCFG.
Step 4: Open SSL client connection by AT+QSSLOPEN.  is used to specify SSL context, and
 is used to specify data access mode.
Step 5: After the SSL connection has been established, data will be sent or received via the connection.
For details about how to send and receive data under each access mode, please refer to
Chapter 1.3.
Step 6: Close SSL connection by AT+QSSLCLOSE.
Step 7: Deactivate the PDP context by AT+QIDEACT.

BG96_SSL_AT_Commands_Manual

Confidential / Released

7 / 27

LTE Module Series
BG96 SSL AT Commands Manual

1.3. Description of Data Access Modes
The SSL connection supports the following three kinds of data access modes:




Buffer access mode
Direct push mode
Transparent access mode

When opening an SSL connection via AT+QSSLOPEN, the data access mode can be specified by the
parameter . After the SSL connection has been established, customers can switch the
access mode via AT+QISWTMD.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

1.

In buffer access mode, data are sent via AT+QSSLSEND command, and if the module has received
data from the Internet, it will report a URC as “+QSSLURC: “recv”,”. Customers can
retrieve data via AT+QSSLRECV command.

2.

In direct push mode, data are sent via AT+QSSLSEND command, and if the module has received
data from the Internet, the data will be outputted directly via UART1/USB modem/USB AT port in the
following format: +QSSLURC: “recv”,,.

3.

In transparent access mode, the corresponding port enters into exclusive mode. The data received
from COM port will be sent to the Internet directly, and the received data from Internet will be
outputted to COM port directly. Customers can use “+++” or DTR (AT&D1 should be set first) to
switch to buffer access mode. In transparent access mode, if SSL connection encounters any
abnormal disconnection, the module will report “NO CARRIER”.

4.

To exit from transparent access mode, “+++” or DTR (AT&D1 should be set first) can be used. To
prevent the “+++” from being misinterpreted as data, the following sequence should be followed:
1)
2)
3)
4)

5.

Do not input any character within 1s or longer before inputting “+++”.
Input “+++” within 1s, and no other characters can be inputted during the time.
Do not input any character within 1s after “+++” has been inputted.
Use “+++” or DTR (AT&D1 should be set first) to make the module exit from transparent access
mode, and wait until “OK” is returned.

There are two methods to return back to transparent access mode:
1)
2)

By AT+QISWTMD. Specify the  as 2 when executing this command. If entering
into transparent access mode successfully, “CONNECT” will be returned.
By ATO. ATO will change the access mode of connection that exits from transparent access
mode lately. If entering transparent access mode successfully, “CONNECT” will be returned. If
there is no connection entering into transparent access mode before, ATO will return “NO
CARRIER”.

BG96_SSL_AT_Commands_Manual

Confidential / Released

8 / 27

LTE Module Series
BG96 SSL AT Commands Manual

1.4. Validity Check for Certificate
To check whether a certificate is in the validity period, the certificate must be parsed, and compare the
local time with the “Not before” and “Not after” of the certificate. If the local time is earlier than the time of
“Not before” or later than the time of “Not after”, the certificate will be considered expired.
When validity check for certification is required ( set as 0 when executing AT+QSSLCFG), in
order to avoid failure of certificate validity check, AT+CCLK command should be used to configure the
module time within the validity time period of the certificate.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
BG96_SSL_AT_Commands_Manual

Confidential / Released

9 / 27

LTE Module Series
BG96 SSL AT Commands Manual

2

Description of SSL AT Commands

2.1. Description of AT Commands

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

2.1.1. AT+QSSLCFG

Configure Parameters of an SSL Context

The command can be used to configure the SSL version, cipher suites, security level, CA certificate, client
certificate and client key. These parameters will be used in the handshake procedure.

 is the index of the SSL context. The module supports 6 SSL contexts at most. On the basis of
one SSL context, several SSL connections can be established. The settings such as the SSL version and
the cipher suite are stored in the SSL context, and they will be applied to the new SSL connections
associated with the SSL context.

AT+QSSLCFG

Configure Parameters of an SSL Context

Test Command
AT+QSSLCFG=?

Response
+QSSLCFG: "sslversion",(0-5),(0-4)
+QSSLCFG:
"ciphersuite",(0-5),(0X0035,0X002F,0X0005,0X0004,0X00
0A,0X003D,0XC011,0XC012,0XC013,0XC014,0XC027,0X
C028,0XC02F,0XFFFF)
+QSSLCFG: "cacert",(0-5),
+QSSLCFG: "clientcert",(0-5),
+QSSLCFG: "clientkey",(0-5),
+QSSLCFG: "seclevel",(0-5),(0-2)
+QSSLCFG: "ignorelocaltime",(0-5),(0,1)
+QSSLCFG: "negotiatetime",(0-5),(10-300)
OK

Write Command
Configure the SSL version for the
specified SSL context:
AT+QSSLCFG="sslversion",[,]

Response
If  is omitted, query the SSL version for the
specified SSL context, and response:
+QSSLCFG: "sslversion",,
OK

If  is not omitted, set the SSL version for the

BG96_SSL_AT_Commands_Manual

Confidential / Released

10 / 27

LTE Module Series
BG96 SSL AT Commands Manual

specified SSL context, and response:
OK
Or
ERROR
Write Command
Configure the SSL cipher suites for the
specified SSL context:
AT+QSSLCFG="ciphersuite",[,]

Response
If  is omitted, query the SSL cipher suites for
the specified SSL context, and response:
+QSSLCFG: "ciphersuite",,
OK

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
If  is not omitted, set the SSL cipher suite for
the specified SSL context, and response:
OK
Or
ERROR

Write Command
Configure the path of trusted CA
certificate for the specified SSL context:
AT+QSSLCFG="cacert",[,]

Response
If  is omitted, query the path of trusted CA
certificate for the specified SSL context, and response:
+QSSLCFG: "cacert",,
OK

If  is not omitted, set the path of trusted CA
certificate for the specified SSL context, and response:
OK
Or
ERROR

Write Command
Configure the path of client certificate for
the specified SSL context:
AT+QSSLCFG="clientcert",[
,]

Response
If  is omitted, query the path of client
certificate for the specified SSL context, and response:
+QSSLCFG: "clientcert",,
OK

If  is not omitted, set the path of client
certificate for the specified SSL context, and response:
OK
Or
ERROR

Write Command
Configure the path of client private key for
the specified SSL context:
AT+QSSLCFG="clientkey",[,

BG96_SSL_AT_Commands_Manual

Response
If  is omitted, query the path of client
private key for the specified SSL context , and response:
+QSSLCFG: "clientkey",,

Confidential / Released

11 / 27

LTE Module Series
BG96 SSL AT Commands Manual

]
OK
If  is not omitted, set the path of client
private key for the specified SSL context, and response:
OK
Or
ERROR
Write Command
Configure the authentication mode for the
specified SSL context:
AT+QSSLCFG="seclevel",[,
]

Response
If  is omitted, query the authentication mode for
the specified SSL context, and response:
+QSSLCFG: "seclevel",,

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
OK

If  is not omitted, set the authentication mode for
the specified SSL context, and response:
OK
Or
ERROR

Write Command
Configure whether to ignore validity
check for certification for the specified
SSL context:
AT+QSSLCFG="ignorelocaltime",[,]

Response
If  is omitted, query whether the validity check
for certification is ignored for the specified SSL context , and
response:
+QSSLCFG: "ignorelocaltime",,
OK

If  is not omitted, set whether or not to ignore
certification validity check for the specified SSL context, and
response:
OK
Or
ERROR

Write Command
Configure the maximum timeout in SSL
negotiation stage for the specified SSL
context:
AT+QSSLCFG="negotiatetime",[,]

Response
If  is omitted, query the maximum timeout
in SSL negotiation stage for the specified SSL context, and
response:
+QSSLCFG:
"negotiatetime",,
OK

If  is not omitted, set the maximum timeout

BG96_SSL_AT_Commands_Manual

Confidential / Released

12 / 27

LTE Module Series
BG96 SSL AT Commands Manual

in SSL negotiation stage for the specified SSL context, and
response:
OK
Or
ERROR

Parameter







Numeric type. SSL context ID. The range is 0-5.
Numeric type. SSL Version.
0
SSL3.0
1
TLS1.0
2
TLS1.1
3
TLS1.2
4
All
Numeric type. SSL cipher suites.
0X0035
TLS_RSA_WITH_AES_256_CBC_SHA
0X002F
TLS_RSA_WITH_AES_128_CBC_SHA
0X0005
TLS_RSA_WITH_RC4_128_SHA
0X0004
TLS_RSA_WITH_RC4_128_MD5
0X000A
TLS_RSA_WITH_3DES_EDE_CBC_SHA
0X003D
TLS_RSA_WITH_AES_256_CBC_SHA256
0XC011
TLS_ECDHE_RSA_WITH_RC4_128_SHA
0XC012
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
0XC013
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
0XC014
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
0XC027
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
0XC028
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
0XC02F
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
0XFFFF
Support all
Numeric format. How to deal with expired certificate.
0
Care about validity check for certification
1
Ignore validity check for certification
String format. The path of the trusted CA certificate.
String format. The path of the client certificate.
String format, the path of the client private key.
Numeric format. The authentication mode.
0
No authentication
1
Manage server authentication
2
Manage server and client authentication if requested by the remote
server
Numeric format. Indicates maximum timeout used in SSL negotiation stage. The
value rang is 10-300, and the default value is 300. Unit: second.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C








BG96_SSL_AT_Commands_Manual

Confidential / Released

13 / 27

LTE Module Series
BG96 SSL AT Commands Manual

2.1.2. AT+QSSLOPEN

Open an SSL Socket to Connect a Remote Server

The command is used to set up an SSL connection. During the negotiation between the module and the
Internet, parameters configured by AT+QSSLCFG will be used in the handshake procedure. After shaking
hands with the Internet successfully, the module can send or receive data via this SSL connection. Also
the module can set up several SSL connections based on one SSL context.
According to steps mentioned in Chapter 1.2, before executing AT+QSSLOPEN, AT+QIACT command
should be executed first to activate the PDP context.
It is suggested to wait for a specific period of time (refer to the Maximum Response Time below) for
“+QSSLOPEN: ,” URC to be outputted. If the URC response cannot be received during
the time, AT+QSSLCLOSE command can be used to close the SSL connection.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

AT+QSSLOPEN Open an SSL Socket to Connect a Remote Server
Test Command
AT+QSSLOPEN=?

Response
+QSSLOPEN:
(1-16),(0-5),(0-11),,[,(0-2)]
OK

Write Command
AT+QSSLOPEN=,,,,[,]

Response
If the  is transparent access mode and the
SSL connection is successfully set up, response:
CONNECT
If there is any error, response:
ERROR
Error description can be got via AT+QIGETERROR.

If the  is buffer access mode or direct push
mode, response:
OK

+QSSLOPEN: ,
 is 0 when SSL socket is opened successfully, otherwise
 is not 0.
If there is any error, response:
ERROR
Error description can be got via AT+QIGETERROR.

Maximum Response Time

BG96_SSL_AT_Commands_Manual

Maximum network response time of 150s, plus configured
time of .

Confidential / Released

14 / 27

LTE Module Series
BG96 SSL AT Commands Manual

Parameter









Numeric type. PDP context ID. The range is 1-16.
Numeric type. SSL context ID. The range is 0-5.
Numeric type. Socket index. The range is 0-11.
String type. The address of remote server.
Numeric type. The listening port of remote server.
Numeric type. The access mode of SSL connection.
0
Buffer access mode
1
Direct push mode
2
Transparent mode
Integer type. The error code of the operation. Please refer to Chapter 5.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

2.1.3. AT+QSSLSEND

Send Data via SSL Connection

After the connection is established, the module can send data through the SSL connection.

AT+QSSLSEND Send Data via SSL Connection
Test Command
AT+QSSLSEND=?

Response
+QSSLSEND: (0-11)[,(1-1460)]
OK

Write Command
AT+QSSLSEND=
After response “>”, input the data to be
sent. Tap CTRL+Z to send, and tap
ESC to cancel the operation.

Response
>



If connection has been established and sending is successful,
response:
SEND OK
If connection has been established but sending buffer is full,
response:
SEND FAIL
If connection has not been established, abnormally closed, or
the parameter is incorrect, response:
ERROR

Write Command
AT+QSSLSEND=,
After response “>”, input data until the
data length is equal to .

BG96_SSL_AT_Commands_Manual

Response
>

If connection has been established and sending is successful,

Confidential / Released

15 / 27

LTE Module Series
BG96 SSL AT Commands Manual

response:
SEND OK
If connection has been established but sending buffer is
full, response:
SEND FAIL
If connection has not been established, abnormally closed, or
the parameter is incorrect, response:
ERROR

Parameter



l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Numeric type. Socket index. The range is 0-11.
Numeric type. The length of sending data. The range is 1-1500. Unit: byte.

2.1.4. AT+QSSLRECV

Receive Data via SSL Connection

When an SSL connection is opened with  specified as 0, the module will report URC as
“+QSSLURC: “recv”,” if it receives data from the Internet. Customers can read the data from
buffer by AT+QSSLRECV command.

AT+QSSLRECV

Receive Data via SSL Connection

Test Command
AT+QSSLRECV=?

Response
+QSSLRECV: (0-11),(1-1500)
OK

Write Command
AT+QSSLRECV=,

Response
If the specified connection has received data, response:
+QSSLRECV: 
OK

If the buffer is empty, response:
+QSSLRECV: 0
OK

If parameters is incorrect or the connection cannot be
established, response:
ERROR

BG96_SSL_AT_Commands_Manual

Confidential / Released

16 / 27

LTE Module Series
BG96 SSL AT Commands Manual

Parameter





Numeric type. Socket index. The range is 0-11.
Numeric type. The length of data to be retrieved. The range is 1-1500. Unit: byte.
Numeric type. The actual data length obtained by AT+QSSLRECV. Unit: byte.
The retrieved data.

2.1.5. AT+QSSLCLOSE

Close an SSL Connection

The command is used to close an SSL connection. If all the SSL connections based on the same SSL
context are closed, the module will release the SSL context.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

AT+QSSLCLOSE

Close an SSL Connection

Test Command
AT+QSSLCLOSE=?

Response
+QSSLCLOSE: (0-11),(0-65535)
OK

Write Command
AT+QSSLCLOSE=[,]

Response
If successfully closed, response:
OK
If failed to close, response:
ERROR

Parameter




Numeric type. Socket index. The range is 0-11.
Numeric type. The timeout value of AT+QSSLCLOSE. The range is 0-65535, and
the default value is 10. Unit: second. 0 means close immediately.

2.1.6. AT+QSSLSTATE

Query the State of SSL Connection

The command is used to query the socket connection status. It can only query the status of SSL
connection.

AT+QSSLSTATE

Query the State of SSL Connection

Test Command
AT+QSSLSTATE=?

Response
OK

Write Command
AT+QSSLSTATE=

Response
+QSSLSTATE:
,“SSLClient”,,,,,,,,,
OK
Execution Command
AT+QSSLSTATE

Response
List of
(+QSSLSTATE:
,“SSLClient”,,,,,,,,,)
OK

Parameter






l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C








Numeric type. Socket index. The range is 0-11.
String type. The address of remote server.
Numeric type. The port of remote server.
Numeric type. The local port.
Numeric type. The state of SSL connection.
0 “Initial”
Connection has not been established
1 “Opening”
Client is connecting
2 “Connected”
Client connection has been established
4 “Closing”
Connection is closing
Numeric type. PDP context ID. The range is 1-16.
Numeric type. Reserved.
Numeric type. The access mode of SSL connection.
0 Buffer access mode
1 Direct push mode
2 Transparent access mode
String type. COM port.
Numeric type. SSL context ID. The range is 0-5.

2.2. Description of URC

2.2.1. Notify Received Data

Notify received data which comes from peer.

Notify Received Data
+QSSLURC: "recv",

BG96_SSL_AT_Commands_Manual

The URC of SSL data incoming in buffer access mode. SSL
data can be received by AT+QSSLRECV.

Confidential / Released

18 / 27

LTE Module Series
BG96 SSL AT Commands Manual

+QSSLURC:
"recv",,


The URC of SSL data incoming in direct push mode.

Parameter




Integer type. Socket index. The range is 0-11.
Integer type. The length of actual received data.
The received data.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

2.2.2. Notify Abnormal Close

Notify that the connection has been disconnected. Lots of reasons can cause this phenomenon, such as
the Internet closes the connection or the state of GPRS PDP is deactivated. The SSL connection state
based on the specified socket will be “closing”. In such case, AT+QSSLCLOSE= must be
executed to change the SSL connection state to “initial”.

Notify Abnormal Close

+QSSLURC: "closed",

Parameter


The SSL connection based on the specified socket is closed.

Integer type. Socket index. The range is 0-11.

BG96_SSL_AT_Commands_Manual

Confidential / Released

19 / 27

LTE Module Series
BG96 SSL AT Commands Manual

3

Examples

3.1. Configure and Activate a PDP Context

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

3.1.1. Configure a PDP Context

//Configure context 1. APN is “CMCIOT”.

AT+QICSGP=1,1,“CMCIOT”,“”,“”,1
OK

3.1.2. Activate a PDP Context
AT+QIACT=1
OK
AT+QIACT?
+QIACT: 1,1,1,"10.7.157.1"
OK

//Activate context 1.
//Activated successfully.
//Query the state of context.

3.1.3. Deactivate a PDP Context
AT+QIDEACT=1
OK

//Deactivate context 1.
//Deactivated successfully.

3.2. Configure an SSL Context
AT+QSSLCFG=“sslversion”,1,1
OK
AT+QSSLCFG=“ciphersuite”,1,0X0035
OK
AT+QSSLCFG=“seclevel”,1,1
OK
AT+QSSLCFG=“cacert”,1,“cacert.pem”
OK

BG96_SSL_AT_Commands_Manual

Confidential / Released

20 / 27

LTE Module Series
BG96 SSL AT Commands Manual

3.3. SSL Client Works in Buffer Access Mode
3.3.1. Set up an SSL Connection and Enter into Buffer Access Mode
AT+QSSLOPEN=1,1,4,"220.180.239.201",8010,0
OK
+QSSLOPEN: 4,0
//Set up an SSL connection successfully.
AT+QSSLSTATE
//Query the status of all SSL connections.
+QSSLSTATE: 4,"SSLClient","220.180.239.201",8010,65344,2,1,4,0,"usbmodem",1
OK

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

3.3.2. Send Data in Buffer Access Mode
AT+QSSLSEND=4
> Test data from SSL

SEND OK
AT+QSSLSEND=4,18
> Test data from SSL
SEND OK

//Send changeable length data.

//Send fixed length data and the data length is 18 bytes.

3.3.3. Receive Data in Buffer Access Mode
+QSSLURC: “recv”,4

//The  4 received data.

AT+QSSLRECV=4,1500
+QSSLRECV: 18
Test data from SSL

//Read data. The length of data to be retrieved is 1500 bytes.
//The actual received data length is 18 bytes.

OK
AT+QSSLRECV=4,1500
+QSSLRECV: 0

//No data in buffer.

OK

BG96_SSL_AT_Commands_Manual

Confidential / Released

21 / 27

LTE Module Series
BG96 SSL AT Commands Manual

3.3.4. Close an SSL Connection
AT+QSSLCLOSE=4

//Close a connection whose  is 4. Depending on the
network, the maximum response time is 10s.

OK

3.4. SSL Client Works in Direct Push Mode
3.4.1. Set up an SSL Connection and Enter into Direct Push Mode

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

AT+QSSLOPEN= 1,1,4,"220.180.239.201",8011,1
OK

+QSSLOPEN: 4,0
//Set up SSL connection successfully.
AT+QSSLSTATE
//Query the status of all SSL connections.
+QSSLSTATE: 4,"SSLClient","220.180.239.201",8011,65047,2,1,4,1,"usbmodem",1
OK

3.4.2. Send Data in Direct Push Mode
AT+QSSLSEND=4
>Test data from SSL

SEND OK
AT+QSSLSEND=4,18
>Test data from SSL
SEND OK

//Send changeable length data.

//Send fixed length data and the data length is 18 bytes.

3.4.3. Receive Data in Direct Push Mode
+QSSLURC: "recv",4,18
Test data from SSL

3.4.4. Close an SSL Connection
AT+QSSLCLOSE=4

//Close a connection whose  is 4. Depending on the
network, the maximum response time is 10s.

OK

BG96_SSL_AT_Commands_Manual

Confidential / Released

22 / 27

LTE Module Series
BG96 SSL AT Commands Manual

3.5. SSL Client Works in Transparent Access Mode
3.5.1. Set up an SSL Connection and Send Data in Transparent Access Mode
AT+QSSLOPEN= 1,1,4,"220.180.239.201",8011,2 //Set up an SSL connection.
CONNECT
//Enter into transparent access mode.
//Client is sending data from COM port to the Internet directly. (The data
is not visible in the example.)
OK
//Use “+++” or DTR (AT&D1 should be set first) to exit from transparent
access mode. The “NO CARRIER” result code indicates that the
server has stopped the SSL connection.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

3.5.2. Set up an SSL Connection and Receive Data in Transparent Access Mode

AT+QSSLOPEN= 1,1,4,"220.180.239.201",8011,2 //Set up an SSL connection.
CONNECT

//Client is reading the data.
OK
//Use “+++” or DTR (AT&D1 should be set first) to exit from transparent
access mode. The “NO CARRIER” result code indicates that the server
has stopped the SSL connection.

3.5.3. Close an SSL Connection
AT+QSSLCLOSE=4
OK

//Close a connection whose  is 4. Depending on the network,
the maximum response time is 10s.

BG96_SSL_AT_Commands_Manual

Confidential / Released

23 / 27

LTE Module Series
BG96 SSL AT Commands Manual

4

Error Handling

4.1. Open SSL Connection Fails

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

If it is failed to open SSL connection, please check the following aspects:

1. Query the status of the specified PDP context by AT+QIACT? command to check whether the
specified PDP context has been activated.

2. If the address of server is a domain name, please check whether the address of DNS server is valid
by AT+QIDNSCFG=. Because an invalid DNS server address cannot convert domain
name to IP address.

3. Please check the SSL configuration by AT+QSSLCFG command, especially the SSL version and
cipher suite, so as to make sure they are supported on server side. If  has been configured
as 1 or 2, customers must upload trusted CA certificate to the module by FILE AT command. If the
server side has configured “SSLVerifyClient required”, then the customer must upload the client
certificate and client private key to the module by FILE AT commands. For details about certificate
validity check, please refer to Chapter 1.4. And for more details about related FILE AT commands,
please refer to Quectel_BG96_FILE_Application_Note.

BG96_SSL_AT_Commands_Manual

Confidential / Released

24 / 27

LTE Module Series
BG96 SSL AT Commands Manual

5

Summary of Error Codes

If an “ERROR” is returned after executing SSL AT commands, the details of error can be queried by
AT+QIGETERROR. Please note that AT+QIGETERROR command just returns error code of the last SSL
AT command.

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C

Table 3: Summary of Error Codes

0
550
551
552
553
554
555
556
557
558
559
560
561

Meaning

Operation successful
Unknown error

Operation blocked
Invalid parameter

Memory not enough
Create socket failed

Operation not supported
Socket bind failed

Socket listen failed
Socket write failed
Socket read failed

Socket accept failed

Open PDP context failed

562

Close PDP context failed

563

Socket identity has been used

564

DNS busy

BG96_SSL_AT_Commands_Manual

Confidential / Released

25 / 27

LTE Module Series
BG96 SSL AT Commands Manual

565

DNS parse failed

566

Socket connection failed

567

Socket has been closed

568

Operation busy

569

Operation timeout

570

PDP context break down

571
572
573
574

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
Cancel send

Operation not allowed
APN not configured
Port busy

BG96_SSL_AT_Commands_Manual

Confidential / Released

26 / 27

LTE Module Series
BG96 SSL AT Commands Manual

6

Appendix A References

Table 4: Related Documents
SN

Document Name

Remark

[1]

GSM 07.07

Digital cellular telecommunications (Phase
2+); AT command set for GSM Mobile
Equipment (ME)

[2]

GSM 07.10

Support GSM 07.10 multiplexing protocol

[3]

Quectel_BG96_TCP(IP)_AT_Commands_
Manual

Introduction
commands

[4]

Quectel_BG96_FILE_AT_Commands_Manual

Introduction about BG96 FILE AT commands

l
e
t
l
c
a
e
i
t
u
n
Q ide
f
n
o
C
about

BG96

TCP/IP

AT

Table 5: Terms and Abbreviations
Abbreviation
DNS
DTR
PDP
SSL

BG96_SSL_AT_Commands_Manual

Description

Domain Name Server
Data Terminal Ready

Packet Data Protocol

Security Socket Layer

Confidential / Released

27 / 27



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.6
Linearized                      : No
Encryption                      : Standard V4.4 (128-bit)
User Access                     : Print, Copy, Extract, Print high-res
Author                          : kelly
Create Date                     : 2017:11:07 09:44:41+08:00
Modify Date                     : 2017:11:07 09:47:06+08:00
Has XFA                         : No
Language                        : zh-CN
XMP Toolkit                     : Adobe XMP Core 4.2.1-c041 52.342996, 2008/05/07-20:48:00
Format                          : application/pdf
Creator                         : kelly
Creator Tool                    : Microsoft® Word 2010
Metadata Date                   : 2017:11:07 09:47:06+08:00
Producer                        : Microsoft® Word 2010
Document ID                     : uuid:4271dfd3-f6c6-4fd8-96ea-27ebadb4adb5
Instance ID                     : uuid:dc3d0ec8-9995-44b9-8bbc-b06353c7bff3
Page Mode                       : UseOutlines
Page Count                      : 28
EXIF Metadata provided by EXIF.tools

Navigation menu