Skip to content

Commit cebdd7b

Browse files
authored
Wire root_ca to the C layer (#211)
* Update aws-c-iot submodule * Pass root ca to aws-c-iot layer
1 parent d42acb9 commit cebdd7b

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

secure_tunneling/include/aws/iotsecuretunneling/SecureTunnel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace Aws
3333
const std::string &accessToken, // Make a copy and save in this object
3434
aws_secure_tunneling_local_proxy_mode localProxyMode,
3535
const std::string &endpointHost, // Make a copy and save in this object
36+
const std::string &rootCa, // Make a copy and save in this object
3637

3738
OnConnectionComplete onConnectionComplete,
3839
OnSendDataComplete onSendDataComplete,
@@ -80,6 +81,7 @@ namespace Aws
8081
Aws::Crt::Io::SocketOptions m_socketOptions;
8182
std::string m_accessToken;
8283
std::string m_endpointHost;
84+
std::string m_rootCa;
8385

8486
aws_secure_tunnel *m_secure_tunnel;
8587
};

secure_tunneling/source/SecureTunnel.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace Aws
1717
const std::string &accessToken,
1818
aws_secure_tunneling_local_proxy_mode localProxyMode,
1919
const std::string &endpointHost,
20+
const std::string &rootCa,
2021

2122
OnConnectionComplete onConnectionComplete,
2223
OnSendDataComplete onSendDataComplete,
@@ -36,6 +37,7 @@ namespace Aws
3637
m_socketOptions = socketOptions;
3738
m_accessToken = accessToken;
3839
m_endpointHost = endpointHost;
40+
m_rootCa = rootCa;
3941

4042
// Initialize aws_secure_tunneling_connection_config
4143
aws_secure_tunneling_connection_config config;
@@ -48,6 +50,7 @@ namespace Aws
4850
config.access_token = aws_byte_cursor_from_c_str(m_accessToken.c_str());
4951
config.local_proxy_mode = localProxyMode;
5052
config.endpoint_host = aws_byte_cursor_from_c_str(m_endpointHost.c_str());
53+
config.root_ca = m_rootCa.c_str();
5154

5255
config.on_connection_complete = s_OnConnectionComplete;
5356
config.on_send_data_complete = s_OnSendDataComplete;
@@ -74,6 +77,7 @@ namespace Aws
7477
m_socketOptions = other.m_socketOptions;
7578
m_accessToken = std::move(other.m_accessToken);
7679
m_endpointHost = std::move(other.m_endpointHost);
80+
m_rootCa = std::move(other.m_rootCa);
7781

7882
m_secure_tunnel = other.m_secure_tunnel;
7983

@@ -104,6 +108,7 @@ namespace Aws
104108
m_socketOptions = other.m_socketOptions;
105109
m_accessToken = std::move(other.m_accessToken);
106110
m_endpointHost = std::move(other.m_endpointHost);
111+
m_rootCa = std::move(other.m_rootCa);
107112

108113
m_secure_tunnel = other.m_secure_tunnel;
109114

secure_tunneling/tests/SecureTunnelTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ static int before(struct aws_allocator *allocator, void *ctx)
8383
"access_token",
8484
testContext->localProxyMode,
8585
"endpoint",
86+
"",
8687
s_OnConnectionComplete,
8788
s_OnSendDataComplete,
8889
s_OnDataReceive,

0 commit comments

Comments
 (0)