Skip to content

Commit 5fe3eca

Browse files
Kaltalenc-j-hughes
authored andcommitted
Positive validation on cert with no chain errors (#155)
If there are no chain errors allow the cert to be trusted
1 parent 76f3e8b commit 5fe3eca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/AdoNetCore.AseClient/Internal/InternalConnectionFactory.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,15 @@ private bool UserCertificateValidationCallback(object sender, X509Certificate se
206206
}
207207
}
208208

209+
if (!(certificateChainPolicyErrors || untrustedRootChainStatusFlags))
210+
{
211+
//No chain Errors, we will trust the server certificate.
212+
return true;
213+
}
214+
209215
// The TrustedFile is a file containing the public keys, in PEM format of the trusted
210216
// root certificates that this client is willing to accept TLS connections from.
211-
if ((certificateChainPolicyErrors || untrustedRootChainStatusFlags) && !string.IsNullOrWhiteSpace(_parameters.TrustedFile) && File.Exists(_parameters.TrustedFile))
217+
if (!string.IsNullOrWhiteSpace(_parameters.TrustedFile) && File.Exists(_parameters.TrustedFile))
212218
{
213219
try
214220
{

0 commit comments

Comments
 (0)