NetSock_CfgServerCertKeyInstall
Install certificate (CERT) and private key (KEY) from a buffer which must be used by a server.
File
net_sock.h/net_sock.c
Called from
Application
Prototype
CPU_BOOLEAN NetSock_CfgSecureServerCertKeyInstall ( NET_SOCK_ID sock_id, const void *p_cert, CPU_INT32U cert_len, const void *p_key, CPU_INT32U key_len, NET_SOCK_SECURE_CERT_KEY_FMT fmt, CPU_BOOLEAN cert_chain, NET_ERR *p_err)
Arguments
sock_id
Socket descriptor/handle identifier of server socket to configure secure certificate and key.
p_cert
Pointer to buffer that contains the certificate.
cert_len
Certificate length.
p_key
Pointer to buffer that contains the key.
key_len
Key length.
fmt
Certificate and key format:
NET_SOCK_SECURE_CERT_KEY_FMT_PEM
NET_SOCK_SECURE_CERT_KEY_FMT_DER
cert_chain
Certificate point to a chain of certificate.
DEF_YES
Certificate points to a chain of certificate.DEF_NO
Certificate points to a single certificate.
p_err
Pointer to variable that will receive the return error code from this function:
NET_SOCK_ERR_NONE
NET_SOCK_ERR_NOT_USED
NET_SOCK_ERR_INVALID_ARG
NET_SOCK_ERR_INVALID_TYPE
NET_SOCK_ERR_INVALID_STATE
NET_SOCK_ERR_INVALID_OP
NET_SOCK_ERR_API_DIS
NET_INIT_ERR_NOT_COMPLETED
NET_SOCK_ERR_INVALID_SOCK
NET_SECURE_ERR_NOT_AVAIL
NET_ERR_FAULT_LOCK_ACQUIRE
Returned Value
DEF_OK
,
certificate and key successfully installed;
DEF_FAIL
,
otherwise.
Required Configuration
Available only if NET_SECURE_CFG_EN
is enabled (see section Transport Layer Security Configuration).
Notes / Warnings
The socket’s secure mode must be configured before calling this function, see function NetSock_CfgSecure().
Available only for stream-type sockets (e.g., TCP sockets).