且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android的应用内结算验证

更新时间:2023-01-01 20:19:41

第一个问题,有没有一个安全的理由为远程服务器做的随机数生成/检查?

是的,服务器应该生成随机数,并做了检查。作为一般规则,所有与安全有关的应该差不多永诺将在服务器完成。 随机数是数字只能使用一次。因此,正确的东西的服务器是:

Yes, the server should generate the nonce, and do the check. As a general rule, everything security-related should almost allways be done in the server. A nonce is a "number only used once". So, the correct thing for the server is to:

  1. 生成并保存一个随机数。
  2. 在收到答复。
    • 如果答案中包含已保存的随机数,检查签名并对其进行处理。 ERASE随机数。
    • 如果答案中包含未保存的随机数,这是最可能是一个制造/复制一个,所以放弃。
  1. generate and save a nonce.
  2. receive an answer.
    • if the answer contains a saved nonce, check the signature and process it. ERASE THE NONCE.
    • if the answer contains an unsaved nonce, it is most probably a fabricated/replicated one, so discard.

第二个问题是,为什么它的问题,如果我们的公共密钥是一个字符串?

这一点,如果你对aplication执行安全检查,如果你做你的工作的服务器上(你应该)完全地无关。

A little if you perform security checks on the aplication, completly irrelevant if you do your work on a server (as you should).

如果您在aplication执行安全,那么aplication可以砍死绕过安全。一种方法是改变公共密钥,至极是比较容易,如果它被保存为一个字符串。

If you perform security in the aplication, then the aplication can be hacked to bypass the security. One technique is to change the public key, wich is easier if it is saved as a single string.

第三个问题,也不会我有所有这些同样的问题试图从我的远程服务器验证的验证(例如存储在应用程序中的公共密钥给我的远程服务器)?

没有你不会的。没有人可以访问/修改服务器的code。至少为易为可在aplication。

No you won't. No one can access/change the code of the server. At least as "easy" as the can in the aplication.

第四个问题,都是徒劳的这种额外的安全性,如果我想存储在手机上购买这个核查结果(即我不希望有验证解锁内容时的购买状态用户访问的内容)?

嗯,这取决于。

在securest的方式来实现应用内购买具有服务器意味着:

The "securest" way to implement in-app purchases having a server implies:

  • 您保存在服务器中的购买的内容。如果用户购买它,将其下载到aplication,并保存它以某种方式难以复制到另一部手机。
  • 从服务器,只有在验证过程是在服务器中做正确发送内容。
  • 从aplication,如果你发现没有救的内容,执行恢复交易的操作,然后下载从服务器所需要的一切。
  • 在谷歌播放的应用程序内购买不能够很轻松地提供内容,它的目的是从一个集中的网站等进行采购,easyer用户。我们的开发人员结束了工作,很多使用它。