设置 TrustKit
Setting up TrustKit
我正在开发一个应用程序,该应用程序很快需要包含 https
以进行网络通信。当我们注意到我们正在通过 URL
发送我们所有的用户凭据时,我们对此感到担忧。这不好,因为这样我们的用户名和密码就公开了。经过大量研究,固定服务器 SSL 证书的 public 密钥似乎是可行的方法。我决定使用 TrustKit
固定证书的 public 密钥,这样我们就不必在应用程序中固定整个证书。这样我们就不必在过期时继续更换证书,因此不必构建新的 IPA 或提交给 Apple。为了解决这个问题 运行,我需要回答几个问题。
所以我明白开始使用 TrustKit
需要做三件主要的事情。
1. 我需要知道我们将要使用的 域 并将它们包含在我们的 info.plist 中.
- 问题:该域的服务器是否需要做任何准备才能
TrustKit
处理所有事情?
2. 我需要 2 public key hashes 也需要包含在 info.plist .
- 问题:如何从证书中提取 public 密钥散列?我从哪里得到这些哈希值?
3. 我需要知道要使用什么 public 键 算法。
- 问题:这是什么?我如何找出使用哪一个?
一旦所有这些都准备就绪,我还需要做些什么来确保 TrustKit
它的长期工作吗?
服务器本身不需要做任何特别的事情,但您的 ops/infrastructure 团队需要;参见 2. 和备用引脚。
TrustKit 提供了一个 Python 脚本来生成您正在寻找的哈希和算法:https://github.com/datatheorem/TrustKit/blob/master/get_pin_from_certificate.py . You need use the script on your domain's CA certificate (this will be the first hash), and then on another CA certificate, from which you bought a backup certificate for your domain. This backup pin is needed in case you need to quickly rotate the (first) certificate on your server, without bricking your App. This is explained in more details here: https://noncombatant.org/2015/05/01/about-http-public-key-pinning/ .
2 中描述的脚本。还有 returns 算法。它是嵌入在服务器证书中的 public 密钥的算法(RSA、ECDSA)。这是 TrustKit 所需要的,因为 iOS 不提供自动检测证书算法的 API。
要从证书(及更多信息)中获取算法和哈希值,请使用
我正在开发一个应用程序,该应用程序很快需要包含 https
以进行网络通信。当我们注意到我们正在通过 URL
发送我们所有的用户凭据时,我们对此感到担忧。这不好,因为这样我们的用户名和密码就公开了。经过大量研究,固定服务器 SSL 证书的 public 密钥似乎是可行的方法。我决定使用 TrustKit
固定证书的 public 密钥,这样我们就不必在应用程序中固定整个证书。这样我们就不必在过期时继续更换证书,因此不必构建新的 IPA 或提交给 Apple。为了解决这个问题 运行,我需要回答几个问题。
所以我明白开始使用 TrustKit
需要做三件主要的事情。
1. 我需要知道我们将要使用的 域 并将它们包含在我们的 info.plist 中.
- 问题:该域的服务器是否需要做任何准备才能
TrustKit
处理所有事情?
2. 我需要 2 public key hashes 也需要包含在 info.plist .
- 问题:如何从证书中提取 public 密钥散列?我从哪里得到这些哈希值?
3. 我需要知道要使用什么 public 键 算法。
- 问题:这是什么?我如何找出使用哪一个?
一旦所有这些都准备就绪,我还需要做些什么来确保 TrustKit
它的长期工作吗?
服务器本身不需要做任何特别的事情,但您的 ops/infrastructure 团队需要;参见 2. 和备用引脚。
TrustKit 提供了一个 Python 脚本来生成您正在寻找的哈希和算法:https://github.com/datatheorem/TrustKit/blob/master/get_pin_from_certificate.py . You need use the script on your domain's CA certificate (this will be the first hash), and then on another CA certificate, from which you bought a backup certificate for your domain. This backup pin is needed in case you need to quickly rotate the (first) certificate on your server, without bricking your App. This is explained in more details here: https://noncombatant.org/2015/05/01/about-http-public-key-pinning/ .
2 中描述的脚本。还有 returns 算法。它是嵌入在服务器证书中的 public 密钥的算法(RSA、ECDSA)。这是 TrustKit 所需要的,因为 iOS 不提供自动检测证书算法的 API。
要从证书(及更多信息)中获取算法和哈希值,请使用