SSL主机名匹配如何在JWS上工作? [英] How does SSL Hostname matching work on JWS?

查看:55
本文介绍了SSL主机名匹配如何在JWS上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用适用于Android的Google SafetyNet时,文档建议您

When using Google SafetyNet for Android the documentation suggest that you

验证SSL证书链并使用SSL主机名匹配来 确保叶子证书是attest.android.com

Validate the SSL certificate chain and use SSL Hostname matching to ensure the leaf certification was issues to attest.android.com

现在如何运作?我本来以为我得到了JWS消息,检查了证书和签名等,但是会针对从attest.android.com抓取的证书进行验证,但是attest.android.com不是实时主机.

Now how does this work? I would have assumed that I get the JWS message inspect the certs and signature etc but would validate against a cert grabbed from attest.android.com, but attest.android.com is not a live host.

SSL签名是否可以在不知道域公钥的情况下进行验证?即我可以验证传入的JWS消息中的所有内容吗?我不知道这怎么可能,是吗?

Does SSL signing cater for validation without previously knowing the public key of the domain? i.e. Can I validate everything from incoming JWS message? I don't see how this is possible, is it?

推荐答案

不幸的是,该文档并不是您必须要做的描述.

Unfortunately, the documentation is not very descriptive as what you have to do.

JWS数据包括三个部分:标头,有效负载和签名.为简化起见,标头包含用于对有效负载进行签名的公钥证书,并且签名位于末尾.

The JWS data includes three sections: the header, the payload and the signature. Simplifying things, the header contains the public key certificates used to sign the payload, and the signature is included at the end.

要验证SafetyNet JWS,首先需要提取嵌入在标头中的证书.这些证书具有可以验证为公共根证书的信任链,因此您应该验证这些证书确实是有效证书,并且已颁发给attest.android.com.

To validate a SafetyNet JWS, you first need to extract the certificates embedded in the header. These certificates have trust chains that can be validated to a public root certificate, so you should verify that these are indeed valid certificates, and that they are issued to attest.android.com.

然后您取出签名,并针对嵌入的证书进行验证.

Then you take out the signature, and verify it against the embedded certificates.

如果选中此选项,则可以信任有效负载.但是在查看basicIntegrityctsProfileMatch之前,请确保apkPackageNameapkDigestSha256apkCertificateDigestSha256与您的应用程序匹配,以便您知道响应实际上来自未修改的应用程序.

If you check this, then you can trust the payload. But before looking at basicIntegrity and ctsProfileMatch, please ensure that apkPackageName, apkDigestSha256 and apkCertificateDigestSha256 match those of your app, so you know that the response actually comes from your unmodified app.

最理想的情况是,您的编程语言应包括一个JWS库和一个SSL库,可以为您做到这一点,因此您不必自己编写. 公共示例包含一个Java示例供您阅读.

Optimally, your programming language should include a JWS library and an SSL library that can do this for you, so you don't have to write this yourself. The public sample includes a Java sample for you to peruse.

这篇关于SSL主机名匹配如何在JWS上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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