Network Credential#

Functions#

sl_status_t
sl_net_set_credential(sl_net_credential_id_t id, sl_net_credential_type_t type, const void *credential, uint32_t credential_length)

Set a network credential including client credentials, certificates, and keys.

sl_status_t
sl_net_get_credential(sl_net_credential_id_t id, sl_net_credential_type_t *type, void *credential, uint32_t *credential_length)

Retrieve a stored network credential.

sl_status_t
sl_net_delete_credential(sl_net_credential_id_t id, sl_net_credential_type_t type)

Delete a stored network credential.

Function Documentation#

sl_net_set_credential#

sl_status_t sl_net_set_credential (sl_net_credential_id_t id, sl_net_credential_type_t type, const void * credential, uint32_t credential_length)

Set a network credential including client credentials, certificates, and keys.

Parameters
TypeDirectionArgument NameDescription
sl_net_credential_id_t[in]id

Network credential identifier as identified by sl_net_credential_id_t.

sl_net_credential_type_t[in]type

Network credential type as identified by sl_net_credential_type_t.

const void *[in]credential

Pointer to the credential data object.

uint32_t[in]credential_length

Length of the credential data object.

This function sets the network credential type and data for the specified credential ID. The credential data can include client credentials, certificates, and keys.

Repeatedly calling this API with the same ID will overwrite the existing credential type and data.

  • Pre-conditions:

Returns

  • sl_status_t. See Status Codes and WiSeConnect Status Codes for details. If the credential is NULL or the credential length is zero, this API will return an error SL_STATUS_INVALID_PARAMETER.

Note

    • Certificates should follow the standard array format.

    • After every 64 bytes, the special character \n should be used as a delimiter.

    • The private key is prefixed with a header like "-----BEGIN PRIVATE KEY-----" line and postfixed with an footer like"-----END PRIVATE KEY-----".

    • Certificates are prefixed with a header like "-----BEGIN CERTIFICATE-----" line and postfixed with an footer like"-----END CERTIFICATE-----" line.

    • Text outside the prefix and postfix lines is ignored and can be used for metadata.

    • The above mentioned Headers and Footers might vary

    • This API does not support the OPEN Security type for Wi-Fi client credentials.

    • When configuring AP or client interfaces in open security mode, the credential ID must be set to SL_NET_NO_CREDENTIAL_ID.


sl_net_get_credential#

sl_status_t sl_net_get_credential (sl_net_credential_id_t id, sl_net_credential_type_t * type, void * credential, uint32_t * credential_length)

Retrieve a stored network credential.

Parameters
TypeDirectionArgument NameDescription
sl_net_credential_id_t[in]id

Network credential identifier as identified by sl_net_credential_id_t.

sl_net_credential_type_t *[out]type

Network credential type as identified by sl_net_credential_type_t.

void *[out]credential

Pointer to location where credential data is stored.

uint32_t *[inout]credential_length

in: Number of bytes available at credential, out: Number of bytes written.

This function retrieves the network credential data for the specified credential ID. The retrieved credential data is stored in the provided credential object.

  • Pre-conditions:

Returns

Note


sl_net_delete_credential#

sl_status_t sl_net_delete_credential (sl_net_credential_id_t id, sl_net_credential_type_t type)

Delete a stored network credential.

Parameters
TypeDirectionArgument NameDescription
sl_net_credential_id_t[in]id

Network credential identifier as identified by sl_net_credential_id_t.

sl_net_credential_type_t[out]type

Network credential type as identified by sl_net_credential_type_t.

This function deletes the network credential data for the specified credential ID and type. Once deleted, the credential cannot be used for network operations.

  • Pre-conditions:

Returns