If you are not using a purchased certified for your Sqlserver, then you are using a self signed untrusted ssl cert. you need to set trustServerCertificate = true in the connect string.
the o/s must support overriding the certificate validation. If not, you need to install and trust the cert on the local machine or not use encryption.