简体   繁体   English

CERTIFICATE_VERIFY_FAILED:无效或不一致的证书扩展名(handshake.cc.359)

[英]CERTIFICATE_VERIFY_FAILED: invalid or inconsistent certificate extension(handshake.cc.359)

This problem only occurs when running my app on Android (Emulator or Physical Device).只有在 Android(模拟器或物理设备)上运行我的应用程序时才会出现此问题。 It's fine on iOS.在iOS上没问题。

I'm getting this error when calling a GET request to my server protected with SSL.向受 SSL 保护的服务器调用 GET 请求时出现此错误。

HandshakeException: Handshake error in client (OS Error: I/flutter (11617):   CERTIFICATE_VERIFY_FAILED: invalid or inconsistent certificate extension(handshake.cc:359))

The SSL Certificate is not self-signed. SSL 证书不是自签名的。 It is signed by my company's own isolated CA.它由我公司自己的独立 CA 签署。 And the CA is 3 tiers (1 root certificate and 2 intermediate certificates underneath). CA 有 3 层(下面有 1 个根证书和 2 个中间证书)。 The last intermediate authority is the one that signed the Server Certificate so the chain of trust is 3 levels.最后一个中间机构是签署服务器证书的机构,因此信任链是 3 个级别。

Certificate details证书详情

  1. CA and IA keys are 512 bits long and uses SHA-512 digestions CA 和 IA 密钥长 512 位,使用 SHA-512 消化
  2. The server certificate key is 2048 bits long with a SHA-256 digestion服务器证书密钥为 2048 位长,带有 SHA-256 消化
  3. The extended key usage of the server certificate is only server authentication服务器证书的扩展密钥用途只是服务器认证
  4. The server certificate is also end-entry服务器证书也是end-entry

I have added the server certificate and the chain of trust to the app itself under my /assets/raw/ directory and have added these to my securityContext (using iOClient for making http calls)我已将服务器证书和信任链添加到我的 /assets/raw/ 目录下的应用程序本身,并将这些添加到我的 securityContext(使用 iOClient 进行 http 调用)

Flutter doctor results颤振医生结果

[✓] Flutter (Channel stable, 2.2.2, on macOS 11.4 20F71 darwin-x64, locale en-PH)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.57.1)
[✓] Connected device (3 available)
    ! Error: Gabe’s iPhone is busy: Copying cache files from device. Xcode will continue when Gabe’s iPhone is finished. (code -10)

• No issues found!

我通过向 android/app/src/debug/AndroidManifest.xml 添加一行来解决这个问题:

<application android:usesCleartextTraffic="true"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 DioError HandshakeException:客户端握手错误(操作系统错误:CERTIFICATE_VERIFY_FAILED:证书已过期(handshake.cc:393)) - DioError HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: certificate has expired(handshake.cc:393)) Flutter - CERTIFICATE_VERIFY_FAILED - Flutter - CERTIFICATE_VERIFY_FAILED Android 存储库 SSL CERTIFICATE_VERIFY_FAILED - Android repo SSL CERTIFICATE_VERIFY_FAILED Flutter on android CERTIFICATE_VERIFY_FAILED:证书已过期 - Flutter on android CERTIFICATE_VERIFY_FAILED: certificate has expired CERTIFICATE_VERIFY_FAILED:所有 flutter 应用程序的证书已过期 - CERTIFICATE_VERIFY_FAILED: certificate has expired on all flutter apps 在 2021 年 9 月 30 日之后使用 LetsEncrypt SSL 证书在 Android 7 CERTIFICATE_VERIFY_FAILED 上颤动 - Flutter on Android 7 CERTIFICATE_VERIFY_FAILED with LetsEncrypt SSL cert after Sept 30, 2021 通过 boost 验证 android 中的证书失败 - Verify certificate in android by boost failed DefaultHttpClient Android SSL 无对等证书且握手失败 - DefaultHttpClient Android SSL No peer certificate and Handshake failed 图像资源服务捕获的异常 (handshake.cc:359) - Exception Caught by Image Resource Service (handshake.cc:359) 在android的ssl握手过程中无法附加客户端证书 - Failed to attach client certificate during ssl handshake in android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM