如何在Alamofire中实施自签名证书? [英] How to implement self signed certificates in Alamofire?

查看:234
本文介绍了如何在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中实施自签名证书?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆