Network Credential AT Commands#

This section describes AT commands for managing network credentials.

Commands#

net-cred-wifipsk#

Configure a Pre-shared Key (PSK) for use while joining an Access Point.

Command Format#

at+net-cred-wifipsk=<credential-id>,<psk>

Related SDK API#

Pre-conditions#

  • oper_mode=0 (Wi-Fi Client)

Parameters#

credential-id#

A unique networking credentials identifier. Contains a numeric value that corresponds to one of the values of the enum sl_net_credential_id_t in sl_net_constants.h.

psk#

A string that contains the PSK to use for authentication with the specified SSID when connecting to the Access Point. The value may be enclosed in double quotes. If it contains commas, it must be enclosed in double quotes (").

Response#

  • OK on success

  • ERROR <error code> in case of failure. Possible error codes are the same as those returned by the sl_net_set_credential API.

Notes#

This command sets a structure of type sl_net_wifi_psk_credential_entry_t with the given PSK and then invokes the sl_net_set_credential API to save the credential information under the given credential-id.

Examples#

at+net-cred-wifipsk=1,"Silabs1234"        # Set PSK "Silabs1234" for Credential ID 1
OK

net-cred-signcert#

Configure a CA certificate to use for exchanging encrypted messages with the MQTT broker using Transport Layer Security (TLS).

Command Format#

at+net-cred-signcert=<credential-id>,<ca-cert-len>

Related SDK API#

Pre-conditions#

  • oper_mode=0 (Wi-Fi Client)

Parameters#

credential-id#

A unique networking credentials identifier. Contains a numeric value that corresponds to one of the values of the enum sl_net_credential_id_t in sl_net_constants.h.

ca-cert-len#

Length of CA certificate

Response#

  • ERROR 1 on failing to enter data mode.

  • OK on successfully entering data mode.

    • On receiving this response, you must transmit ca-cert-len number of characters.

    • As soon as the specified number of characters is transmitted, the certificate save operation is initiated, and one of the following responses is returned:

      • OK on success

      • ERROR <error code> in case of failure. Possible error codes are the same as those returned by the sl_net_set_credential API.

Notes#

  • This command invokes the sl_net_set_credential API to save the credential information under the given credential-id.

Examples#

at+net-cred-signcert=768,512        # Save the <CA certificate string> under Credential ID 768 (TLS Server Certificate)
OK
<CA certificate string>
OK

net-cred-httpclient#

Configure a username and password to authenticate the SiWx91x device as an HTTP client while connecting to an HTTP server.

Command Format#

at+net-cred-httpclient=<credential-id>,<username>,<password>

Related SDK API#

Pre-conditions#

net-init

Parameters#

credential-id#

A unique networking credentials identifier. Contains a numeric value that corresponds to one of the values of the enum sl_net_credential_id_t in sl_net_constants.h. To set an HTTP client credential, the value must be greater than or equal to the enum value SL_NET_HTTP_CLIENT_CREDENTIAL_START and less than 1792 (7 << 8), the most likely starting value for the next category of Credential IDs in the enum.

username#

A string that contains the username to use for authentication when connecting to an HTTP server.

password#

A string that contains the password to use for authentication when connecting to an HTTP server.

Response#

  • OK on success

  • ERROR <error code> in case of failure. Possible error codes are the same as those returned by the sl_net_set_credential API.

Notes#

This command sets a structure of type sl_http_client_credentials_t with the given username and password and then invokes the sl_net_set_credential API to save the credential information under the given credential-id with a credential type of SL_NET_HTTP_CLIENT_CREDENTIAL.

Examples#

at+net-cred-httpclient=1536,"SilabsUser","SilabsPassword"        # Save SilabsUser and SilabsPassword as username and password under Credential ID 1536 (HTTP Client Credential)
OK

net-cred-mqttclient#

Configure a username and password to authenticate the SiWx91x device as an MQTT client while connecting to an MQTT broker.

Command Format#

at+net-cred-mqttclient=<credential-id>,<username>,<password>

Related SDK API#

Pre-conditions#

  • oper_mode=0 (Wi-Fi Client)

Parameters#

credential-id#

A unique networking credentials identifier. Contains a numeric value that corresponds to one of the values of the enum sl_net_credential_id_t in sl_net_constants.h. To set an MQTT client credential, the value must be greater than or equal to the enum value SL_NET_MQTT_CLIENT_CREDENTIAL_START and less than SL_NET_HTTP_SERVER_CREDENTIAL_START.

username#

A string that contains the username to use for authentication when connecting to an MQTT broker.

password#

A string that contains the password to use for authentication when connecting to an MQTT broker.

Response#

  • OK on success

  • ERROR <error code> in case of failure. Possible error codes are the same as those returned by the sl_net_set_credential API.

Notes#

This command sets a structure of type sl_mqtt_client_credentials_t with the given username and password and then invokes the sl_net_set_credential API to save the credential information under the given credential-id with a credential type of SL_NET_MQTT_CLIENT_CREDENTIAL.

Examples#

at+net-cred-mqttclient=1024,"SilabsUser","SilabsPassword"        # Save SilabsUser and SilabsPassword as username and password under Credential ID 1024 (MQTT Client Credential)
OK