Skip to content

Commit

Permalink
Optionally set ca cert path (#309)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Morgan <[email protected]>
  • Loading branch information
p487morgan and Paul Morgan authored Jul 25, 2022
1 parent f1344fb commit 6369b99
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,14 @@ Channel::ChannelImpl *Channel::OpenSecureChannel(
#endif

try {
int status =
amqp_ssl_socket_set_cacert(socket, tls_params.ca_cert_path.c_str());
if (status) {
throw AmqpLibraryException::CreateException(
status, "Error setting CA certificate for socket");
int status;
if (tls_params.ca_cert_path != "") {
status =
amqp_ssl_socket_set_cacert(socket, tls_params.ca_cert_path.c_str());
if (status) {
throw AmqpLibraryException::CreateException(
status, "Error setting CA certificate for socket");
}
}

if (tls_params.client_key_path != "" && tls_params.client_cert_path != "") {
Expand Down

0 comments on commit 6369b99

Please sign in to comment.