|
Zephyr API Documentation 4.5.99
A Scalable Open Source RTOS
|
TLS credentials management. More...
Macros | |
| #define | SEC_TAG_TLS_INVALID (-1) |
| Invalid secure tag value. | |
Typedefs | |
| typedef int | sec_tag_t |
| Secure tag, a reference to TLS credential. | |
Enumerations | |
| enum | tls_credential_type { TLS_CREDENTIAL_NONE , TLS_CREDENTIAL_CA_CERTIFICATE , TLS_CREDENTIAL_PUBLIC_CERTIFICATE , TLS_CREDENTIAL_PRIVATE_KEY , TLS_CREDENTIAL_PSK , TLS_CREDENTIAL_PSK_ID , TLS_CREDENTIAL_PRIVATE_KEY_PSA , TLS_CREDENTIAL_PSK_PSA } |
| TLS credential types. More... | |
Functions | |
| int | tls_credential_add (sec_tag_t tag, enum tls_credential_type type, const void *cred, size_t credlen) |
| Add a TLS credential. | |
| int | tls_credential_get (sec_tag_t tag, enum tls_credential_type type, void *cred, size_t *credlen) |
| Get a TLS credential. | |
| int | tls_credential_delete (sec_tag_t tag, enum tls_credential_type type) |
| Delete a TLS credential. | |
| int | tls_credential_expiry (sec_tag_t tag, enum tls_credential_type type, time_t *expiry) |
| Get the expiry time of a TLS credential. | |
TLS credentials management.
| #define SEC_TAG_TLS_INVALID (-1) |
#include <zephyr/net/tls_credentials.h>
Invalid secure tag value.
| typedef int sec_tag_t |
#include <zephyr/net/tls_credentials.h>
Secure tag, a reference to TLS credential.
Secure tag can be used to reference credential after it was registered in the system.
| enum tls_credential_type |
#include <zephyr/net/tls_credentials.h>
TLS credential types.
| Enumerator | |
|---|---|
| TLS_CREDENTIAL_NONE | Unspecified credential. |
| TLS_CREDENTIAL_CA_CERTIFICATE | A trusted CA certificate. Use this to authenticate remote servers. Used with certificate-based ciphersuites. |
| TLS_CREDENTIAL_PUBLIC_CERTIFICATE | A public client or server certificate. Use this to register your own certificate. Should be registered together with a corresponding private key. Used with certificate-based ciphersuites. |
| TLS_CREDENTIAL_PRIVATE_KEY | Private key. Should be registered together with a corresponding public certificate. Used with certificate-based ciphersuites. |
| TLS_CREDENTIAL_PSK | Pre-shared key. Should be registered together with a corresponding PSK identity. Used with PSK-based ciphersuites. |
| TLS_CREDENTIAL_PSK_ID | Pre-shared key identity. Should be registered together with a corresponding PSK. Used with PSK-based ciphersuites. |
| TLS_CREDENTIAL_PRIVATE_KEY_PSA | Private key resident in PSA. The credential buffer holds a |
| TLS_CREDENTIAL_PSK_PSA | Pre-shared key resident in PSA. It should be registered together with a corresponding PSK identity (TLS_CREDENTIAL_PSK_ID) and it should be used with PSK-based ciphersuites. The credential buffer holds a |
| int tls_credential_add | ( | sec_tag_t | tag, |
| enum tls_credential_type | type, | ||
| const void * | cred, | ||
| size_t | credlen ) |
#include <zephyr/net/tls_credentials.h>
Add a TLS credential.
This function adds a TLS credential, that can be used by TLS/DTLS for authentication.
| tag | A security tag that credential will be referenced with. |
| type | A TLS/DTLS credential type. |
| cred | A TLS/DTLS credential. |
| credlen | A TLS/DTLS credential length. |
CONFIG_TLS_CREDENTIALS_BACKEND_VOLATILE), the credential data is not copied. Only the cred pointer is stored, so the buffer must stay valid and unchanged for as long as the tag is in use, that is, until the credential is removed with tls_credential_delete.| 0 | TLS credential successfully added. |
| -EACCES | Access to the TLS credential subsystem was denied. |
| -ENOMEM | Not enough memory to add new TLS credential. |
| -EEXIST | TLS credential of specific tag and type already exists. |
| int tls_credential_delete | ( | sec_tag_t | tag, |
| enum tls_credential_type | type ) |
#include <zephyr/net/tls_credentials.h>
Delete a TLS credential.
This function removes a TLS credential, referenced by tag secure tag of type.
| tag | A security tag corresponding to removed credential. |
| type | A TLS/DTLS credential type of removed credential. |
| 0 | TLS credential successfully deleted. |
| -EACCES | Access to the TLS credential subsystem was denied. |
| -ENOENT | Requested TLS credential was not found. |
| int tls_credential_expiry | ( | sec_tag_t | tag, |
| enum tls_credential_type | type, | ||
| time_t * | expiry ) |
#include <zephyr/net/tls_credentials.h>
Get the expiry time of a TLS credential.
| tag | The security tag of the TLS credential. |
| type | The type of the TLS credential. |
| expiry | Pointer to store the expiry time. |
| 0 | TLS credential expiry time successfully obtained. |
| -EACCES | Access to the TLS credential subsystem was denied. |
| -ENOENT | Requested TLS credential was not found. |
| -ENOTSUP | TLS credential storage does not support expiry time retrieval. |
| int tls_credential_get | ( | sec_tag_t | tag, |
| enum tls_credential_type | type, | ||
| void * | cred, | ||
| size_t * | credlen ) |
#include <zephyr/net/tls_credentials.h>
Get a TLS credential.
This function gets an already registered TLS credential, referenced by tag secure tag of type.
| tag | A security tag of requested credential. |
| type | A TLS/DTLS credential type of requested credential. |
| cred | A buffer for TLS/DTLS credential. |
| credlen | A buffer size on input. TLS/DTLS credential length on output. |
| 0 | TLS credential successfully obtained. |
| -EACCES | Access to the TLS credential subsystem was denied. |
| -ENOENT | Requested TLS credential was not found. |
| -EFBIG | Requested TLS credential does not fit in the buffer provided. Check *credlen for size required. |