为 Google Android 应用内购买伪造签名字符串

发布于 2024-11-28 05:12:54 字数 331 浏览 1 评论 0原文

我正在验证来自 Android 应用内购买的签名字符串,我知道足以编写一个基于服务器的独立验证来检查该字符串是否使用我的公钥和 JSON 响应中发送的私钥进行签名,这很好。在我缺乏知识的情况下,如果人们可以访问我的公钥,他们是否能够使用私钥对字符串进行签名并向我的外部服务器发送响应,从而成功验证?

我可能错过了一些东西,但是在我的iPhone应用程序上,我联系Apple,他们联系应用程序,我用苹果响应联系我的服务器,它联系苹果并独立验证响应,我对我的WP7应用程序与PayPal做同样的事情,与Google,我没有连接到 Google 来验证该字符串,我只是检查该字符串是否用我的密钥签名,这真的足够了吗?

谢谢

I am verifying a signed string from Android inapp purchases, I know enough to have written a server based independent verification to check that the string is signed with my public key and the private key sent in the JSON response, thats fine. Where my knowledge is lacking, wouldn't it be possible for people, if they have access to my public key, to be able to sign a string with a private key and send a response to my external server, which would successfully validate?

I am probably missing something, but on my iPhone app I contact Apple, they contact the app back, I contact my server with apples response, it contacts apple and independantly verifies the response, I do the same for my WP7 app with PayPal, with Google, I am not connecting to Google to verify the string, I am just checking the string is signed with my Keys, is this truly enough?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

病毒体 2024-12-05 05:12:54

简而言之,不。如果有时间,您可以阅读 RSA,但非对称算法(加密/签名的密钥与解密/验证的密钥不同)的全部要点是,实际上不可能找出另一半如果您只有一把钥匙。因此,如果某人拥有您的公钥,您可以非常确定他们无法生成私钥。或者,如果他们只是生成一个新密钥,那么当您验证签名时,您将收到验证错误。

如果您的随机数确实是随机的并且实际上只使用了一次,那么它们也无法重播相同的消息,因此您应该相当安全。 (假设没有实现问题)

您应该更担心的是人们使用字节码修补工具绕过整个验证过程并从 isLicensed() 方法返回 true。

In short, no. You can read up on RSA if you have the time, but the whole point of asymmetric algorithms (where the key you encrypt/sign is different from the one you decrypt/verify with), is that is practically impossible to figure out the other half of the key if you only have one. Thus, if someone has your public key, you can be pretty sure they cannot produce the private one. Alternatively, if they just generate a new key, when you verify the signature, you will get a verification error.

If your nonces are truly random and really only used once, they cannot replay the same message either, so you should be reasonably safe. (assuming there are no implementation problems)

What you should be more worried about is people using bytecode patching tools to bypass the whole validation process and just return true from the isLicensed() method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文