Network connection works in cmd Line app but not SwiftUI app

I'm writing a SwiftUI LDAP Browser. I built a command line swift app to do some testing and it works fine. I had to add the certificates from the LDAP server to the system keychain before it would work with TLS/SSL.

Then I ported the same code into a SwiftUI app but I cannot get it to connect via TLS/SSL. On the same machine with the same certs it errors with: An unexpected error occurred: message("Can't contact LDAP server")

It connect fine with our TLS/SSL.

I suspect this may have to do with App Transport Security. Can anyone point me in the right direction to resolve this? App is MacOS only.

I created a info.plist and added NSAllowsArbitraryLoads=true but that made no difference. Grabbed a trace with Wireshark and I see the TLS negotiation failing with an error 48, Unknown CA.

Can anyone provide any insight into why certificate trust evaluation succeeds with the cmd line app but fails from the SwiftUI app? The cow making the connection is identical!

Network connection works in cmd Line app but not SwiftUI app
 
 
Q