使用固定在 Android 上的 OkHttp 证书处理站点证书过期
Handle site certificate expiry with OkHttp Certificate pinning on Android
我有一个应用程序,其站点证书哈希与 OkHttp3 固定,类似于提到的方法 here
虽然网站证书即将到期,但我意识到我需要能够在我切换更新网站后立即支持新的网站证书,并让当前的证书继续工作直到然后。有没有一种方法可以为同一站点固定 2 个证书,以便无缝地支持两者(即当当前证书过期并且一个不再有效以及新证书更新时)?
TIA
这是 CertificatePinner 的记录行为。因此,只需为您的当前和旧证书添加别针即可。
Confirms that at least one of the certificates pinned for hostname is
in peerCertificates. Does nothing if there are no certificates pinned
for hostname. OkHttp calls this after a successful TLS handshake, but
before the connection is used.
n.b。由于您的证书可能会在旧客户端更新之前过期,因此通常建议您也固定您使用的 CA,这很可能在新旧证书之间保持一致。这将确保即使您当前和下一个证书过期或被吊销,您也能够使用生成的新证书和旧客户端进行身份验证。
https://community.letsencrypt.org/t/hpkp-best-practices-if-you-choose-to-implement/4625
我有一个应用程序,其站点证书哈希与 OkHttp3 固定,类似于提到的方法 here
虽然网站证书即将到期,但我意识到我需要能够在我切换更新网站后立即支持新的网站证书,并让当前的证书继续工作直到然后。有没有一种方法可以为同一站点固定 2 个证书,以便无缝地支持两者(即当当前证书过期并且一个不再有效以及新证书更新时)?
TIA
这是 CertificatePinner 的记录行为。因此,只需为您的当前和旧证书添加别针即可。
Confirms that at least one of the certificates pinned for hostname is in peerCertificates. Does nothing if there are no certificates pinned for hostname. OkHttp calls this after a successful TLS handshake, but before the connection is used.
n.b。由于您的证书可能会在旧客户端更新之前过期,因此通常建议您也固定您使用的 CA,这很可能在新旧证书之间保持一致。这将确保即使您当前和下一个证书过期或被吊销,您也能够使用生成的新证书和旧客户端进行身份验证。
https://community.letsencrypt.org/t/hpkp-best-practices-if-you-choose-to-implement/4625