Skip to content

Update | Update SSL certificate error messages#2060

Merged
JRahnama merged 5 commits into
dotnet:mainfrom
JRahnama:update-namemismatch-error
Sep 2, 2023
Merged

Update | Update SSL certificate error messages#2060
JRahnama merged 5 commits into
dotnet:mainfrom
JRahnama:update-namemismatch-error

Conversation

@JRahnama

Copy link
Copy Markdown
Contributor

.Net 7 and greater versions has a new API X509Certificate2.MatchesHostname which could be used to determine if a provided hostname exists in certificate SANs or Subject, unfortunately that is not available in lower versions.
This PR updates the .Net 7 and greater versions with the new API and tries to provide more specific error on lower versions.

@JRahnama JRahnama added the Area\Managed SNI Issues that are targeted to the Managed SNI codebase. label Jun 14, 2023
@JRahnama JRahnama added this to the 5.2.0-preview3 milestone Jun 14, 2023
@codecov

codecov Bot commented Jun 14, 2023

Copy link
Copy Markdown

Codecov Report

Patch has no changes to coverable lines.

Files Changed Coverage
...core/src/Microsoft/Data/SqlClient/SNI/SNICommon.cs 0.00%
...SqlClient/src/Microsoft/Data/Common/AdapterUtil.cs 0.00%

📢 Thoughts on this report? Let us know!.

@David-Engel David-Engel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is another ValidateSslServerCertificate function below the one being modified that needs similar changes to what you are making (the serverCertificate connection option validation).

Comment thread src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx Outdated
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx Outdated
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx Outdated
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx Outdated

@DavoudEshtehari DavoudEshtehari left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd suggest collecting all the possible exceptions and throwing a single exception at the end.

@Kaur-Parminder
Kaur-Parminder marked this pull request as draft July 6, 2023 22:15
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.Designer.cs Outdated
Comment thread src/Microsoft.Data.SqlClient/netcore/src/Resources/Strings.resx Outdated
Comment thread src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs Outdated
Comment thread src/Microsoft.Data.SqlClient/tests/ManualTests/DataCommon/DataTestUtility.cs Outdated
Co-authored-by: DavoudEshtehari <61173489+DavoudEshtehari@users.noreply.github.com>
@JRahnama
JRahnama merged commit 0441595 into dotnet:main Sep 2, 2023
@JRahnama
JRahnama deleted the update-namemismatch-error branch September 8, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Managed SNI Issues that are targeted to the Managed SNI codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants