# HandshakeException：客户端握手错误（操作系统错误：CERTIFICATE_VERIFY_FAILED: ok(handshake.cc:393)）

- **ID:** `flutter/dart-io-ssl-handshake-error`
- **领域:** flutter
- **类别:** network_error
- **验证级别:** ai_generated
- **修复率:** 75%

## 根因

SSL 证书验证失败，通常由自签名证书、证书过期或设备信任存储中缺少中间 CA 导致。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Flutter 3.10 | active | — | — |
| Dart 3.0 | active | — | — |
| iOS 16 | active | — | — |
| Android 13 | active | — | — |

## 解决方案

1. ```
   Add the self-signed certificate to the device's trust store, or use a proper CA-signed certificate on the server.
   ```
2. ```
   If testing only, use a custom HttpClient with badCertificateCallback that validates the specific certificate fingerprint.
   ```

## 无效尝试

- **** — Disables all certificate validation, creating a security vulnerability and may still fail on some platforms due to other TLS checks. (80% 失败率)
- **** — The underlying SSL issue persists; retrying without fixing the certificate chain will produce the same error. (90% 失败率)
- **** — The http package also relies on dart:io's underlying TLS implementation; the error will be identical. (70% 失败率)
