EST client. More...
Go to the source code of this file.
Data Structures | |
struct | _EstClientContext |
EST client context. More... | |
Macros | |
#define | CYCLONE_EST_VERSION_STRING "2.5.4" |
#define | CYCLONE_EST_MAJOR_VERSION 2 |
#define | CYCLONE_EST_MINOR_VERSION 5 |
#define | CYCLONE_EST_REV_NUMBER 4 |
#define | EST_CLIENT_SUPPORT DISABLED |
#define | EST_CLIENT_RSA_SUPPORT ENABLED |
#define | EST_CLIENT_ECDSA_SUPPORT ENABLED |
#define | EST_CLIENT_DEFAULT_TIMEOUT 20000 |
#define | EST_CLIENT_BUFFER_SIZE 4096 |
#define | EST_CLIENT_MAX_HOST_LEN 64 |
#define | EST_CLIENT_MAX_URI_LEN 64 |
#define | EST_CLIENT_MAX_CONTENT_TYPE_LEN 40 |
#define | EST_CLIENT_MAX_CSR_LEN 1024 |
#define | EST_CLIENT_MAX_CERT_LEN 2048 |
#define | EST_CLIENT_MAX_CA_CERTS_LEN 4096 |
#define | EST_CLIENT_PRIVATE_CONTEXT |
#define | EstClientContext struct _EstClientContext |
Typedefs | |
typedef error_t(* | EstClientTlsInitCallback) (EstClientContext *context, TlsContext *tlsContext) |
TLS initialization callback function. More... | |
typedef error_t(* | EstClientCsrGenCallback) (EstClientContext *context, const char_t *challengePwd, uint8_t *buffer, size_t size, size_t *length) |
CSR generation callback function. More... | |
Enumerations | |
enum | EstClientState { EST_CLIENT_STATE_DISCONNECTED = 0, EST_CLIENT_STATE_CONNECTING = 1, EST_CLIENT_STATE_CONNECTED = 2, EST_CLIENT_STATE_GET_CA = 3, EST_CLIENT_STATE_CSR_GEN = 4, EST_CLIENT_STATE_ENROLL = 5, EST_CLIENT_STATE_REENROLL = 6, EST_CLIENT_STATE_DISCONNECTING = 7 } |
EST client states. More... | |
enum | EstRequestState { EST_REQ_STATE_INIT = 0, EST_REQ_STATE_FORMAT_HEADER = 1, EST_REQ_STATE_SEND_HEADER = 2, EST_REQ_STATE_FORMAT_BODY = 3, EST_REQ_STATE_SEND_BODY = 4, EST_REQ_STATE_RECEIVE_HEADER = 5, EST_REQ_STATE_PARSE_HEADER = 6, EST_REQ_STATE_RECEIVE_BODY = 7, EST_REQ_STATE_CLOSE_BODY = 8, EST_REQ_STATE_COMPLETE = 9 } |
HTTP request states. More... | |
Functions | |
error_t | estClientInit (EstClientContext *context) |
EST client initialization. More... | |
error_t | estClientRegisterTlsInitCallback (EstClientContext *context, EstClientTlsInitCallback callback) |
Register TLS initialization callback function. More... | |
error_t | estClientRegisterCsrGenCallback (EstClientContext *context, EstClientCsrGenCallback callback) |
Register CSR generation callback function. More... | |
error_t | estClientSetPrng (EstClientContext *context, const PrngAlgo *prngAlgo, void *prngContext) |
Set the pseudo-random number generator to be used. More... | |
error_t | estClientSetTimeout (EstClientContext *context, systime_t timeout) |
Set communication timeout. More... | |
error_t | estClientSetHost (EstClientContext *context, const char_t *host) |
Set the domain name of the EST server. More... | |
error_t | estClientSetPathPrefix (EstClientContext *context, const char_t *pathPrefix) |
Set path prefix. More... | |
error_t | estClientSetAllowedAuthModes (EstClientContext *context, uint_t allowedAuthModes) |
Set allowed HTTP authentication modes. More... | |
error_t | estClientSetAuthInfo (EstClientContext *context, const char_t *username, const char_t *password) |
Set authentication information. More... | |
error_t | estClientBindToInterface (EstClientContext *context, NetInterface *interface) |
Bind the EST client to a particular network interface. More... | |
error_t | estClientConnect (EstClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort) |
Specify the address of the EST server. More... | |
error_t | estClientLoadKeyPair (EstClientContext *context, const char_t *publicKey, size_t publicKeyLen, const char_t *privateKey, size_t privateKeyLen, const char_t *password) |
Load public/private key pair. More... | |
void | estClientUnloadKeyPair (EstClientContext *context) |
Unload public/private key pair. More... | |
error_t | estClientLoadCert (EstClientContext *context, const char_t *input, size_t length) |
Load client's certificate. More... | |
error_t | estClientStoreCert (EstClientContext *context, char_t *output, size_t *written) |
Store client's certificate. More... | |
error_t | estClientLoadCaCerts (EstClientContext *context, const char_t *input, size_t length) |
Load implicit TA database. More... | |
error_t | estClientStoreCaCerts (EstClientContext *context, char_t *output, size_t *written) |
Store CA certificates. More... | |
error_t | estClientGetCaCerts (EstClientContext *context) |
Get CA certificates. More... | |
error_t | estClientEnroll (EstClientContext *context) |
Certificate enrollment. More... | |
error_t | estClientReEnroll (EstClientContext *context) |
Certificate re-enrollment. More... | |
error_t | estClientDisconnect (EstClientContext *context) |
Gracefully disconnect from the EST server. More... | |
error_t | estClientClose (EstClientContext *context) |
Close the connection with the EST server. More... | |
void | estClientDeinit (EstClientContext *context) |
Release EST client context. More... | |
Detailed Description
EST client.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2024-2025 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneEST Open.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- Version
- 2.5.4
Definition in file est_client.h.
Macro Definition Documentation
◆ CYCLONE_EST_MAJOR_VERSION
#define CYCLONE_EST_MAJOR_VERSION 2 |
Definition at line 69 of file est_client.h.
◆ CYCLONE_EST_MINOR_VERSION
#define CYCLONE_EST_MINOR_VERSION 5 |
Definition at line 71 of file est_client.h.
◆ CYCLONE_EST_REV_NUMBER
#define CYCLONE_EST_REV_NUMBER 4 |
Definition at line 73 of file est_client.h.
◆ CYCLONE_EST_VERSION_STRING
#define CYCLONE_EST_VERSION_STRING "2.5.4" |
Definition at line 67 of file est_client.h.
◆ EST_CLIENT_BUFFER_SIZE
#define EST_CLIENT_BUFFER_SIZE 4096 |
Definition at line 105 of file est_client.h.
◆ EST_CLIENT_DEFAULT_TIMEOUT
#define EST_CLIENT_DEFAULT_TIMEOUT 20000 |
Definition at line 98 of file est_client.h.
◆ EST_CLIENT_ECDSA_SUPPORT
#define EST_CLIENT_ECDSA_SUPPORT ENABLED |
Definition at line 91 of file est_client.h.
◆ EST_CLIENT_MAX_CA_CERTS_LEN
#define EST_CLIENT_MAX_CA_CERTS_LEN 4096 |
Definition at line 147 of file est_client.h.
◆ EST_CLIENT_MAX_CERT_LEN
#define EST_CLIENT_MAX_CERT_LEN 2048 |
Definition at line 140 of file est_client.h.
◆ EST_CLIENT_MAX_CONTENT_TYPE_LEN
#define EST_CLIENT_MAX_CONTENT_TYPE_LEN 40 |
Definition at line 126 of file est_client.h.
◆ EST_CLIENT_MAX_CSR_LEN
#define EST_CLIENT_MAX_CSR_LEN 1024 |
Definition at line 133 of file est_client.h.
◆ EST_CLIENT_MAX_HOST_LEN
#define EST_CLIENT_MAX_HOST_LEN 64 |
Definition at line 112 of file est_client.h.
◆ EST_CLIENT_MAX_URI_LEN
#define EST_CLIENT_MAX_URI_LEN 64 |
Definition at line 119 of file est_client.h.
◆ EST_CLIENT_PRIVATE_CONTEXT
#define EST_CLIENT_PRIVATE_CONTEXT |
Definition at line 154 of file est_client.h.
◆ EST_CLIENT_RSA_SUPPORT
#define EST_CLIENT_RSA_SUPPORT ENABLED |
Definition at line 84 of file est_client.h.
◆ EST_CLIENT_SUPPORT
#define EST_CLIENT_SUPPORT DISABLED |
Definition at line 77 of file est_client.h.
◆ EstClientContext
#define EstClientContext struct _EstClientContext |
Definition at line 159 of file est_client.h.
Typedef Documentation
◆ EstClientCsrGenCallback
typedef error_t(* EstClientCsrGenCallback) (EstClientContext *context, const char_t *challengePwd, uint8_t *buffer, size_t size, size_t *length) |
CSR generation callback function.
Definition at line 215 of file est_client.h.
◆ EstClientTlsInitCallback
typedef error_t(* EstClientTlsInitCallback) (EstClientContext *context, TlsContext *tlsContext) |
TLS initialization callback function.
Definition at line 207 of file est_client.h.
Enumeration Type Documentation
◆ EstClientState
enum EstClientState |
EST client states.
Definition at line 171 of file est_client.h.
◆ EstRequestState
enum EstRequestState |
HTTP request states.
Definition at line 188 of file est_client.h.
Function Documentation
◆ estClientBindToInterface()
error_t estClientBindToInterface | ( | EstClientContext * | context, |
NetInterface * | interface | ||
) |
Bind the EST client to a particular network interface.
- Parameters
-
[in] context Pointer to the EST client context [in] interface Network interface to be used
- Returns
- Error code
Definition at line 290 of file est_client.c.
◆ estClientClose()
error_t estClientClose | ( | EstClientContext * | context | ) |
Close the connection with the EST server.
- Parameters
-
[in] context Pointer to the EST client context
- Returns
- Error code
Definition at line 1069 of file est_client.c.
◆ estClientConnect()
error_t estClientConnect | ( | EstClientContext * | context, |
const IpAddr * | serverIpAddr, | ||
uint16_t | serverPort | ||
) |
Specify the address of the EST server.
- Parameters
-
[in] context Pointer to the EST client context [in] serverIpAddr IP address of the EST server to connect to [in] serverPort UDP port number
- Returns
- Error code
Definition at line 313 of file est_client.c.
◆ estClientDeinit()
void estClientDeinit | ( | EstClientContext * | context | ) |
Release EST client context.
- Parameters
-
[in] context Pointer to the EST client context
Definition at line 1090 of file est_client.c.
◆ estClientDisconnect()
error_t estClientDisconnect | ( | EstClientContext * | context | ) |
Gracefully disconnect from the EST server.
- Parameters
-
[in] context Pointer to the EST client context
- Returns
- Error code
Definition at line 1003 of file est_client.c.
◆ estClientEnroll()
error_t estClientEnroll | ( | EstClientContext * | context | ) |
Certificate enrollment.
- Parameters
-
[in] context Pointer to the EST client context
- Returns
- Error code
Definition at line 821 of file est_client.c.
◆ estClientGetCaCerts()
error_t estClientGetCaCerts | ( | EstClientContext * | context | ) |
Get CA certificates.
- Parameters
-
[in] context Pointer to the EST client context
- Returns
- Error code
Definition at line 762 of file est_client.c.
◆ estClientInit()
error_t estClientInit | ( | EstClientContext * | context | ) |
EST client initialization.
- Parameters
-
[in] context Pointer to the EST client context
- Returns
- Error code
Definition at line 62 of file est_client.c.
◆ estClientLoadCaCerts()
error_t estClientLoadCaCerts | ( | EstClientContext * | context, |
const char_t * | input, | ||
size_t | length | ||
) |
Load implicit TA database.
- Parameters
-
[in] context Pointer to the EST client context [out] input Pointer to the PEM-encoded CA certificates [out] length Length of the PEM-encoded CA certificates
- Returns
- Error code
Definition at line 659 of file est_client.c.
◆ estClientLoadCert()
error_t estClientLoadCert | ( | EstClientContext * | context, |
const char_t * | input, | ||
size_t | length | ||
) |
Load client's certificate.
- Parameters
-
[in] context Pointer to the EST client context [out] input Pointer to the PEM-encoded certificate [out] length Length of the PEM-encoded certificate
- Returns
- Error code
Definition at line 563 of file est_client.c.
◆ estClientLoadKeyPair()
error_t estClientLoadKeyPair | ( | EstClientContext * | context, |
const char_t * | publicKey, | ||
size_t | publicKeyLen, | ||
const char_t * | privateKey, | ||
size_t | privateKeyLen, | ||
const char_t * | password | ||
) |
Load public/private key pair.
- Parameters
-
[in] context Pointer to the EST client context [in] publicKey Public key (PEM format) [in] publicKeyLen Length of the public key [in] privateKey Private key (PEM format) [in] privateKeyLen Length of the private key [in] password NULL-terminated string containing the password. This parameter is required if the private key is encrypted
- Returns
- Error code
Definition at line 429 of file est_client.c.
◆ estClientReEnroll()
error_t estClientReEnroll | ( | EstClientContext * | context | ) |
Certificate re-enrollment.
- Parameters
-
[in] context Pointer to the EST client context
- Returns
- Error code
Definition at line 910 of file est_client.c.
◆ estClientRegisterCsrGenCallback()
error_t estClientRegisterCsrGenCallback | ( | EstClientContext * | context, |
EstClientCsrGenCallback | callback | ||
) |
Register CSR generation callback function.
- Parameters
-
[in] context Pointer to the EST client context [in] callback CSR generation callback function
- Returns
- Error code
Definition at line 131 of file est_client.c.
◆ estClientRegisterTlsInitCallback()
error_t estClientRegisterTlsInitCallback | ( | EstClientContext * | context, |
EstClientTlsInitCallback | callback | ||
) |
Register TLS initialization callback function.
- Parameters
-
[in] context Pointer to the EST client context [in] callback TLS initialization callback function
- Returns
- Error code
Definition at line 109 of file est_client.c.
◆ estClientSetAllowedAuthModes()
error_t estClientSetAllowedAuthModes | ( | EstClientContext * | context, |
uint_t | allowedAuthModes | ||
) |
Set allowed HTTP authentication modes.
- Parameters
-
[in] context Pointer to the EST client context [in] allowedAuthModes Logic OR of allowed HTTP authentication schemes
- Returns
- Error code
Definition at line 250 of file est_client.c.
◆ estClientSetAuthInfo()
error_t estClientSetAuthInfo | ( | EstClientContext * | context, |
const char_t * | username, | ||
const char_t * | password | ||
) |
Set authentication information.
- Parameters
-
[in] context Pointer to the EST client context [in] username NULL-terminated string containing the user name to be used [in] password NULL-terminated string containing the password to be used
- Returns
- Error code
Definition at line 273 of file est_client.c.
◆ estClientSetHost()
error_t estClientSetHost | ( | EstClientContext * | context, |
const char_t * | host | ||
) |
Set the domain name of the EST server.
- Parameters
-
[in] context Pointer to the EST client context [in] host NULL-terminated string containing the host name
- Returns
- Error code
Definition at line 199 of file est_client.c.
◆ estClientSetPathPrefix()
error_t estClientSetPathPrefix | ( | EstClientContext * | context, |
const char_t * | pathPrefix | ||
) |
Set path prefix.
- Parameters
-
[in] context Pointer to the EST client context [in] uri NULL-terminated string that contains the path prefix
- Returns
- Error code
Definition at line 224 of file est_client.c.
◆ estClientSetPrng()
error_t estClientSetPrng | ( | EstClientContext * | context, |
const PrngAlgo * | prngAlgo, | ||
void * | prngContext | ||
) |
Set the pseudo-random number generator to be used.
- Parameters
-
[in] context Pointer to the EST client context [in] prngAlgo PRNG algorithm [in] prngContext Pointer to the PRNG context
- Returns
- Error code
Definition at line 154 of file est_client.c.
◆ estClientSetTimeout()
error_t estClientSetTimeout | ( | EstClientContext * | context, |
systime_t | timeout | ||
) |
Set communication timeout.
- Parameters
-
[in] context Pointer to the EST client context [in] timeout Timeout value, in milliseconds
- Returns
- Error code
Definition at line 178 of file est_client.c.
◆ estClientStoreCaCerts()
error_t estClientStoreCaCerts | ( | EstClientContext * | context, |
char_t * | output, | ||
size_t * | written | ||
) |
Store CA certificates.
- Parameters
-
[in] context Pointer to the EST client context [out] output Pointer to the buffer where to store the PEM-encoded CA certificates (optional parameter) [out] written Length of the resulting PEM string
- Returns
- Error code
Definition at line 717 of file est_client.c.
◆ estClientStoreCert()
error_t estClientStoreCert | ( | EstClientContext * | context, |
char_t * | output, | ||
size_t * | written | ||
) |
Store client's certificate.
- Parameters
-
[in] context Pointer to the EST client context [out] output Pointer to the buffer where to store the PEM-encoded certificate (optional parameter) [out] written Length of the resulting PEM string
- Returns
- Error code
Definition at line 624 of file est_client.c.
◆ estClientUnloadKeyPair()
void estClientUnloadKeyPair | ( | EstClientContext * | context | ) |
Unload public/private key pair.
- Parameters
-
[in] context Pointer to the EST client context
Definition at line 522 of file est_client.c.