-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make example to use certificate bundle #627
Make example to use certificate bundle #627
Conversation
To easy maintenance, makes the example on websocket client to use certificate bundle by default.
0b8352a
to
a9f42e3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that using the cert bundle is a better choice when working with a public broker
#if CONFIG_WS_OVER_TLS_SERVER_AUTH || CONFIG_WS_OVER_TLS_MUTUAL_AUTH | ||
// Using certificate bundle as default server certificate source | ||
websocket_cfg.crt_bundle_attach = esp_crt_bundle_attach; | ||
// If using a custom certificate it could be added to certificate bundle, added to the build simmilar to client certificates in this examples, | ||
// or read from NVS. | ||
/* extern const char cacert_start[] asm("ADDED_CERTIFICATE"); */ | ||
/* websocket_cfg.cert_pem = cacert_start; */ | ||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can attach the self signed cert to the bundle, but I'd suggest reverting this and setting up the bundle in the block below.
#if CONFIG_WS_OVER_TLS_SERVER_AUTH || CONFIG_WS_OVER_TLS_MUTUAL_AUTH | |
// Using certificate bundle as default server certificate source | |
websocket_cfg.crt_bundle_attach = esp_crt_bundle_attach; | |
// If using a custom certificate it could be added to certificate bundle, added to the build simmilar to client certificates in this examples, | |
// or read from NVS. | |
/* extern const char cacert_start[] asm("ADDED_CERTIFICATE"); */ | |
/* websocket_cfg.cert_pem = cacert_start; */ | |
#endif |
This way we'd use the bundle only for connecting to the public broker.
#elif CONFIG_WS_OVER_TLS_SERVER_AUTH | ||
extern const char cacert_start[] asm("_binary_ca_certificate_public_domain_pem_start"); // CA cert of wss://echo.websocket.event, modify it if using another server | ||
websocket_cfg.cert_pem = cacert_start; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#elif CONFIG_WS_OVER_TLS_SERVER_AUTH | |
extern const char cacert_start[] asm("_binary_ca_certificate_public_domain_pem_start"); // CA cert of wss://echo.websocket.event, modify it if using another server | |
websocket_cfg.cert_pem = cacert_start; | |
#elif CONFIG_WS_OVER_TLS_SERVER_AUTH | |
websocket_cfg.crt_bundle_attach = esp_crt_bundle_attach; |
To easy maintenance, makes the example on websocket client to use certificate bundle by default.