You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: components/esp_websocket_client/include/esp_websocket_client.h
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -108,10 +108,13 @@ typedef struct {
108
108
intbuffer_size; /*!< Websocket buffer size */
109
109
constchar*cert_pem; /*!< Pointer to certificate data in PEM or DER format for server verify (with SSL), default is NULL, not required to verify the server. PEM-format must have a terminating NULL-character. DER-format requires the length to be passed in cert_len. */
110
110
size_tcert_len; /*!< Length of the buffer pointed to by cert_pem. May be 0 for null-terminated pem */
111
-
constchar*client_cert; /*!< Pointer to certificate data in PEM or DER format for SSL mutual authentication, default is NULL, not required if mutual authentication is not needed. If it is not NULL, also `client_key` has to be provided. PEM-format must have a terminating NULL-character. DER-format requires the length to be passed in client_cert_len. */
111
+
constchar*client_cert; /*!< Pointer to certificate data in PEM or DER format for SSL mutual authentication, default is NULL, not required if mutual authentication is not needed. If it is not NULL, also `client_key` or `client_ds_data` (if supported) has to be provided. PEM-format must have a terminating NULL-character. DER-format requires the length to be passed in client_cert_len. */
112
112
size_tclient_cert_len; /*!< Length of the buffer pointed to by client_cert. May be 0 for null-terminated pem */
113
-
constchar*client_key; /*!< Pointer to private key data in PEM or DER format for SSL mutual authentication, default is NULL, not required if mutual authentication is not needed. If it is not NULL, also `client_cert` has to be provided. PEM-format must have a terminating NULL-character. DER-format requires the length to be passed in client_key_len */
113
+
constchar*client_key; /*!< Pointer to private key data in PEM or DER format for SSL mutual authentication, default is NULL, not required if mutual authentication is not needed. If it is not NULL, also `client_cert` has to be provided and `client_ds_data` (if supported) gets ignored. PEM-format must have a terminating NULL-character. DER-format requires the length to be passed in client_key_len */
114
114
size_tclient_key_len; /*!< Length of the buffer pointed to by client_key_pem. May be 0 for null-terminated pem */
115
+
#ifCONFIG_ESP_TLS_USE_DS_PERIPHERAL
116
+
void*client_ds_data; /*!< Pointer to the encrypted private key data for SSL mutual authentication using the DS peripheral, default is NULL, not required if mutual authentication is not needed. If it is not NULL, also `client_cert` has to be provided. It is ignored if `client_key` is provided */
117
+
#endif
115
118
esp_websocket_transport_ttransport; /*!< Websocket transport type, see `esp_websocket_transport_t */
Copy file name to clipboardExpand all lines: docs/esp_websocket_client/en/index.rst
+36-6Lines changed: 36 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -66,13 +66,43 @@ Configuration:
66
66
.. note:: If you want to verify the server, then you need to provide a certificate in PEM format, and provide to ``cert_pem`` in :cpp:type:`websocket_client_config_t`. If no certficate is provided then the TLS connection will default to not requiring verification.
67
67
68
68
PEM certificate for this example could be extracted from an openssl `s_client` command connecting to websocket.org.
69
-
In case a host operating system has `openssl` and `sed` packages installed, one could execute the following command to download and save the root or intermediate root certificate to a file (Note for Windows users: Both Linux like environment or Windows native packages may be used).
In case a host operating system has `openssl` and `sed` packages installed, one could execute the following command to download and save the root or intermediate root certificate to a file (Note for Windows users: Both Linux like environment or Windows native packages may be used). ::
This command will extract the second certificate in the chain and save it as a pem-file.
75
77
78
+
Mutual TLS with DS Peripheral
79
+
"""""""""""""""""""""""""""""
80
+
81
+
To leverage the Digital Signature (DS) peripheral on supported targets, use `esp_secure_cert_mgr <https://github.com/espressif/esp_secure_cert_mgr/>`_ to flash an encrypted client certificate. In your project, add the dependency: ::
82
+
83
+
idf.py add-dependency esp_secure_cert_mgr
84
+
85
+
Set ``client_cert`` and ``client_ds_data`` in the config struct:
.. note:: ``client_cert`` provided by `esp_secure_cert_mgr` is a null-terminated PEM; so ``client_cert_len`` (DER format) should not be set.
105
+
76
106
Subprotocol
77
107
^^^^^^^^^^^
78
108
@@ -91,14 +121,14 @@ For more options on :cpp:type:`esp_websocket_client_config_t`, please refer to A
91
121
92
122
Events
93
123
------
94
-
* `WEBSOCKET_EVENT_BEGIN': The client thread is running.
124
+
* `WEBSOCKET_EVENT_BEGIN`: The client thread is running.
95
125
* `WEBSOCKET_EVENT_BEFORE_CONNECT`: The client is about to connect.
96
126
* `WEBSOCKET_EVENT_CONNECTED`: The client has successfully established a connection to the server. The client is now ready to send and receive data. Contains no event data.
97
127
* `WEBSOCKET_EVENT_DATA`: The client has successfully received and parsed a WebSocket frame. The event data contains a pointer to the payload data, the length of the payload data as well as the opcode of the received frame. A message may be fragmented into multiple events if the length exceeds the buffer size. This event will also be posted for non-payload frames, e.g. pong or connection close frames.
98
128
* `WEBSOCKET_EVENT_ERROR`: The client has experienced an error. Examples include transport write or read failures.
99
129
* `WEBSOCKET_EVENT_DISCONNECTED`: The client has aborted the connection due to the transport layer failing to read data, e.g. because the server is unavailable. Contains no event data.
100
130
* `WEBSOCKET_EVENT_CLOSED`: The connection has been closed cleanly.
101
-
* `WEBSOCKET_EVENT_FINISH': The client thread is about to exit.
131
+
* `WEBSOCKET_EVENT_FINISH`: The client thread is about to exit.
102
132
103
133
If the client handle is needed in the event handler it can be accessed through the pointer passed to the event handler:
0 commit comments