-
Notifications
You must be signed in to change notification settings - Fork 5.2k
improve handling of TLS certificates on Linux #74695
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
Conversation
|
Tagging subscribers to this area: @dotnet/ncl, @vcsjones Issue DetailsI bump to this when looking at memory use on Linux. To solve that I added custom marshaling (big thanks to @jkoritzinsky for guidance) On client we would typically get valid certificate. I would be curious if there is better way @bartonjs.
|
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.Ssl.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Unix.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/CertificateValidationPal.Unix.cs
Outdated
Show resolved
Hide resolved
…lidationPal.Unix.cs Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
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.
LGTM. Thanks.
I bump to this when looking at memory use on Linux.
There re two parts:
On server the PeerCertificate would typically be null. Current marshaling would allocate
SafeX509Handlein invalid state. And then we would would wrap inSafeFreeCertContextjust to find out there is no certificate.To solve that I added custom marshaling (big thanks to @jkoritzinsky for guidance)
I tried generic on but failed (#74694) so this not has marshaling just for the certificates.
On client we would typically get valid certificate.
We get the
SafeX509Handle, then we wrap it inSafeFreeCertContextjust to callDangerousGetHandle().I'm wondering if we even need
SafeHandlehere but using two seems obsessive. For now, I useSafeX509Handlein pattern similar as before withSafeFreeCertContextgone.I would be curious if there is better way @bartonjs.