Skip to content
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

[SYS] Add alpn #1745

Merged
merged 1 commit into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions main/User_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ const char* certificate PROGMEM = R"EOF("
# define AWS_IOT false
# endif

# if AWS_IOT
// Enable the use of ALPN for AWS IoT Core with the port 443
const char* alpnProtocols[] = {"x-amzn-mqtt-ca", NULL};
# endif

//# define MQTT_HTTPS_FW_UPDATE //uncomment to enable updating via MQTT message.

# ifdef MQTT_HTTPS_FW_UPDATE
Expand Down
5 changes: 5 additions & 0 deletions main/main.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,11 @@ void setupTLS(bool self_signed, uint8_t index) {
Log.notice(F("Using self signed cert index %u" CR), index);
# if defined(ESP32)
sClient->setCACert(certs_array[index].server_cert);
# if AWS_IOT
if (strcmp(mqtt_port, "443") == 0) {
sClient->setAlpnProtocols(alpnProtocols);
}
# endif
# if MQTT_SECURE_SELF_SIGNED_CLIENT
sClient->setCertificate(certs_array[index].client_cert);
sClient->setPrivateKey(certs_array[index].client_key);
Expand Down