如何在Alamofire中实施自签名证书?

编程入门 行业动态 更新时间:2024-10-27 08:28:34
本文介绍了如何在Alamofire中实施自签名证书?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用自签名证书服务器通信编写了一个基于swift的应用程序。 作为一个网络库,我想使用Alamofire。 但是Alamofire不支持自签名证书。

I write a swift based app with a self signed certificate server communication. As a network library I want to use Alamofire. However Alamofire doesn't support self signed certificates.

是否可以轻松实现此功能以及如何实现?

Is it possible to implement this feature easily and how?

推荐答案

Alamofire尚不支持此功能。它最有可能最终由社区添加,但该工作尚未提交给项目。如果你想贡献这个功能,请务必分叉回购并提交拉取请求。

This feature is not yet supported by Alamofire. It will most likely be added eventually by the community, but that work has yet to be submitted to the project. If you feel like contributing this feature, by all means fork the repo and submit a pull request.

如果你想学习如何自己实现这个功能,我会建议您阅读 SSL固定和 TLS验证。您还可以在 AFNetworking 中浏览源代码以获得感觉如何实现它。

If you want to learn how to implement this feature yourself, I'd suggest you read up on SSL pinning and TLS verification on iOS. You could also browse the source code in AFNetworking to get a feel of how it could possibly be implemented.

如果您没有时间自己构建此功能,那么我建议您暂时使用AFNetworking在Swift应用程序中。 AFNetworking与Swift完全兼容,并支持TLS验证。

If you do not have time to build this feature yourself, then I suggest you use AFNetworking for the time being in your Swift app. AFNetworking is perfectly compatible with Swift and does support TLS verification.

更多推荐

如何在Alamofire中实施自签名证书?

本文发布于:2023-11-26 06:05:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632935.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:证书   如何在   Alamofire

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!