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

Allow setting CA certificate during TLS connection #1009

Merged
merged 1 commit into from
Oct 21, 2023

Conversation

melpon
Copy link
Contributor

@melpon melpon commented Oct 21, 2023

Fixes #1007.

Copy link
Owner

@paullouisageneau paullouisageneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR. It works, but architecturally, setting the CA chain in TlsTransport is quite weird, since TlsTransport by itself doesn't perform certificate verification. I think the CA chain should only be set in VerifiedTlsTransport, which would also be simpler as you wouldn't have to forward cacert all the way down to TlsTransport. What do you think?

Moreover, you need to free mCaCert in the destructor and constructor catch block. I'm just noticing now that the TlsTransport destructor is not implemented for MbedTLS... I'm pushing a fix. @Sean-Der if you use Websockets with MbedTLS somewhere, there must be a memory leak.

src/impl/tlstransport.cpp Outdated Show resolved Hide resolved
@melpon
Copy link
Contributor Author

melpon commented Oct 21, 2023

I think the CA chain should only be set in VerifiedTlsTransport

Indeed, you're right. I'll make the changes.

@melpon
Copy link
Contributor Author

melpon commented Oct 21, 2023

I've made the changes and squashed the commits. Thank you for the advice!

Copy link
Owner

@paullouisageneau paullouisageneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks.

@paullouisageneau paullouisageneau merged commit 5145ba8 into paullouisageneau:master Oct 21, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to Connect to TLS when Using MbedTLS
2 participants