Skip to content

Commit

Permalink
Merge pull request #73 from Pranay265/fix-mqttrelay-IoTbroker-conn-wi…
Browse files Browse the repository at this point in the history
…th-tls

Add Option to Skip CA Certificate Validation in MTConnect Agent Configuration
  • Loading branch information
PatrickRitchie authored Sep 26, 2024
2 parents bf4c042 + 232c7b0 commit eb4952c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private async Task Worker()
var certificateAuthorityResults = _configuration.Tls.GetCertificateAuthority();

var certificates = new List<X509Certificate2>();
if (certificateAuthorityResults.Certificate != null)
if (certificateAuthorityResults.Certificate != null && _configuration.Tls.OmitCAValidation == false)
{
certificates.Add(certificateAuthorityResults.Certificate);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private async Task Worker()
var certificateAuthorityResults = _configuration.Tls.GetCertificateAuthority();

var certificates = new List<X509Certificate2>();
if (certificateAuthorityResults.Certificate != null)
if (certificateAuthorityResults.Certificate != null && _configuration.Tls.OmitCAValidation == false)
{
certificates.Add(certificateAuthorityResults.Certificate);
}
Expand Down
2 changes: 2 additions & 0 deletions libraries/MTConnect.NET-TLS/TlsConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class TlsConfiguration
[JsonPropertyName("verifyClientCertificate")]
public bool VerifyClientCertificate { get; set; }

[JsonPropertyName("omitCAValidation")]
public bool OmitCAValidation { get; set; }


public CertificateLoadResult GetCertificate()
Expand Down

0 comments on commit eb4952c

Please sign in to comment.