Arduino core for the ESP32 1.0.4までは、HTTPS(TLS)接続は単に次のコードを実行すれば繋ぐことができました。
WiFiClientSecure client; client.connect("www.howsmyssl.com", 443);
しかし、Arduno core for the ESP32 1.0.5では、上記の接続コード実行前にサーバー証明書の検証方法の明示が必須となり、明示せずに接続すると単に接続に失敗するだけではなく、場合によってはESP32がリスタートするという現象が発生します。
Arduino core for the ESP32 1.0.5のWiFiClinetSecure
クラスにはsetInsecure
メンバが追加されていて、サーバー証明書の検証をせずに接続する場合はsetInsecure
の明示が必須になっています。
WiFiClientSecure client; client.setInsecure(); client.connect("www.howsmyssl.com", 443);
スケッチ例に収録されているWiFiClientSecure
のサンプルコードもArduino core for the ESP32 1.0.4までは次の3つです。
- WiFiClientPSK
- WiFiClientSecure
- WiFiClientSecureEnterprise
Arduino core for the ESP32 1.0.5では上記3つのサンプルコードに以下のサンプルコードが追加されています。
- WiFiClientInsecure