1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use AtatCmd;
use crateDataType;
use NoResponse;
/// This command writes / deletes data (certificates, etc.) to / from the non-volatile (NV) memory. Data stored in nonvolatile memory is not affected by device reboots and software upgrades.
///
/// Attention: A factory reset (see Device Reset to Factory State: AT+SQNSFACTORYRESET (on page 484)) deletes all data written in the NV memory.
///
/// Usage and syntax changes according to the type of data to store.
///
/// ## Certificates
///
/// The form with "certificate" writes a single certificate, or several concatenated certificates, in the non volatile memory. Once the operation is completed, public certificates are immediately available for all client secured IP connection (Device Initiated Upgrade: AT+SQNSUPGRADE (on page 74), Secured socket).
/// For secured sockets in server mode, the certificate <index> must be used to assign private certificate to the secure server.
///
/// An <index> must be provided for the system to identify the certificate (or bundle thereof) in future operations (delete, etc.)
///
/// The ‹size> parameter gives the size in bytes of the certificate to upload: after the command is issued, the user must provide the certificate size in bytes using the PEM (Privacy-enhanced Electronic Mail) format. Once ‹size> bytes have been received, the operation is automatically completed. If the certificate is successfully uploaded and verified, the response is OK. If the upload fails for some reason, then an error code is reported.
///
/// Maximum <size> for certificates is 8 kB.
///
/// Writing a zero byte certificate at ID <index> deletes the certificate stored at that index.
///
/// ## Private key
///
/// This form of the command writes a private key in PEM format to the non-volatile memory. Maximum <size> for private keys is 2 kB.
///
/// Note: Password encrypted private RSA keys are not supported.
///
/// Note: The MQTT broker can provide certificates and private keys files with < CR> < LF> (Carriage Return and Line Feed) endings. The parameter ‹size>, however, must not take the < CR› characters into account.