ssl - TLS client without any server verification - Stack Overflow

admin2025-04-16  3

I'm writing a Toit program that needs to connect to a TLS server in my local network. The server is only able to handle TLS connections but because of the local network I don't need any verification.

Is there a way to disable the TLS verification?

I'm writing a Toit program that needs to connect to a TLS server in my local network. The server is only able to handle TLS connections but because of the local network I don't need any verification.

Is there a way to disable the TLS verification?

Share Improve this question asked Feb 1 at 21:00 Florian LoitschFlorian Loitsch 8,1281 gold badge28 silver badges34 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Toit doesn't provide any way of disabling TLS verification.

However, it's pretty easy to accept the certificate of your local server, even if it wasn't signed by a known certificate authority.

Start by getting the certificate of the local server. You can use Chrome, or simply openssl:

openssl s_client -connect <YOUR-MACHINE>

Take the certificate (typically starting with -----BEGIN CERTIFICATE-----) and store it in your Toit application:

CERTIFICATE ::= """
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

You can then install this certificate as follows:

import tls

CERT ::= """
...
"""

main:
  my-root := tls.RootCertificate CERT
  my-root.install
  // TLS connections to your server should now succeed.
转载请注明原文地址:http://anycun.com/QandA/1744816550a88016.html