flutter
network_error
ai_generated
partial
HandshakeException:客户端握手错误(操作系统错误:CERTIFICATE_VERIFY_FAILED: ok(handshake.cc:393))
HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: ok(handshake.cc:393))
ID: flutter/dart-io-ssl-handshake-error
75%修复率
85%置信度
1证据数
2023-06-01首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Flutter 3.10 | active | — | — | — |
| Dart 3.0 | active | — | — | — |
| iOS 16 | active | — | — | — |
| Android 13 | active | — | — | — |
根因分析
SSL 证书验证失败,通常由自签名证书、证书过期或设备信任存储中缺少中间 CA 导致。
English
SSL certificate verification failed, typically due to a self-signed certificate, expired certificate, or missing intermediate CA in the device's trust store.
官方文档
https://api.flutter.dev/flutter/dart-io/HttpClient-class.html解决方案
-
Add the self-signed certificate to the device's trust store, or use a proper CA-signed certificate on the server.
-
If testing only, use a custom HttpClient with badCertificateCallback that validates the specific certificate fingerprint.
无效尝试
常见但无效的做法:
-
80% 失败
Disables all certificate validation, creating a security vulnerability and may still fail on some platforms due to other TLS checks.
-
90% 失败
The underlying SSL issue persists; retrying without fixing the certificate chain will produce the same error.
-
70% 失败
The http package also relies on dart:io's underlying TLS implementation; the error will be identical.