The GSMSSLUtils class allows to list, store and delete root certificate / key files in .pem format on the modem of dice-IoT devices. The class is used in the example application DICENB -> tools -> SSLCertificateManagement that provides a convenient interface to upload, list, delete the certificates to the user.


myGSMSSLUtils.storeCertificate( s_fileNameInFlash, b_isDefault )
myGSMSSLUtils.deleteCertificate( s_fileNameOnModem );


String s_fileNameInFlash: file name of the new certificate file (must end with .pem) in the serial flash to be transferred onto the modem.
bool b_isDefault:
true = stores the cert file (s_fileNameInFlash) under the default root certificate name “cacert.pem” onto the modem. This is the default root-cert file that the DICENB library uses for SSL connections (e.g. for command connectSSL(), httpGETSSL() ).
false = uses the file name “s_fileNameInFlash” to store the file onto the modem.
String s_fileNameOnModem; file that should be deleted from the modem


int storeCertificate() returns:
1 : OK
0 : Error (e.g. file name does not exist in SerialFlash)

deleteCertificate() returns:
0 – Error (e.g. file does not exist in modem filesystem)
1– OK. File was successfully deleted

listCertificates() returns:
String holding the names of the certificates that are stored in the modem (‘\n’ seperated)

Example Code

See the source code of the ConsoleDev sketch as an example:


Notes and Warnings

The functions rely on the SerialFlash filesystem, hence the function SerialFlash.begin(); needs to be called before working with the GSMSSLUtils can take place.

The GSMSSLUtils are used by the ConsoleDev sketch so that installing certificates can alternatively be done as follows:

  • Menu command: misc -> Generate a certificates file (filename must end with .pem)
  • Compile and flash the sketch Console_Dev.ino on the target (Files -> Example -> Console - > Console_Dev)
  • Download the generated certificate (xyz.pem) file onto the target (Misc -> send file to device)
  • In the C2S console use the commands gsm_cert_def (dice-IoT) or wifi_cert (dice-WiFi) to flash the new certificates onto the modem.

See also