flutter - Flutter 客户端证书认证
问题描述
我正在使用配置为需要客户端证书以允许客户端连接的 WCF 服务。我用邮递员测试了所有东西,服务运行良好。如果我尝试使用颤振客户端进行身份验证,就会出现问题。当然我用的是https。
我试过了
var clientCertificate = (await rootBundle.load('lib/assets/certificates/clientAuthenticationCert.pfx')).buffer.asInt8List();
securityContext.useCertificateChainBytes(clientCertificate, password: "test");
securityContext.usePrivateKeyBytes(clientCertificate, password: "test");
HttpClient httpsClient = HttpClient(context: securityContext);
IOClient httpTest = new IOClient(httpsClient);
http.Response response = await httpTest.post(kIsWeb ? Uri.parse(_serviceEndpointWithProxy) : Uri.parse(_ServiceEndpoint),
headers: {
"Content-Type": "text/xml; charset=utf-8",
"SOAPAction": "http://someUrl/someService/${action}",
"Host": "someService.someUrl.net",
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate, br",
"Content-Length": utf8.encode(envelope).length.toString(),
},
body: envelope,
encoding: Encoding.getByName("utf-8"));
但不幸的是,它抛出了一个例外,没有任何进一步的细节。
任何想法如何使用客户端证书身份验证和颤振?提前致谢
解决方案
推荐阅读
- c# - 如何在 asp.net 中将 JSON 响应作为对象数组获取?
- java - 轮换名单
并保持字数 - python - 通过套接字发送的消息缺少 \n
- c# - 如何读取xml文件并写入字典
- c# - ShowDialog 未打开表单 Visual Studio
- jenkins - 以 root 用户身份 Openshift 容器
- email - 使用 Outlook smtp 服务器发送 ics 文件 RSVP 格式无法正常工作?
- javascript - 在 Node-Red 中将位转换为字节
- excel - 更新 Power Query 中的“过期”公式
- java - 确实需要帮助 线程“JavaFX 应用程序线程”中的异常 java.lang.RuntimeException: java.lang.reflect.InvocationTargetException