Google Play中应用结算算法中的“签名”是什么

时间:2015-04-19 06:09:04

标签: android in-app-purchase rsa google-play-services

Google Play使用RSA算法进行加密/解密。在谷歌播放返回的数据中,有一个名为“签名”的字段。

Bundle containing the following key-value pairs
"RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on failure as listed above.
"INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs
"INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information
"INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures of the purchase information
"INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the next set of in-app purchases. Only set if the user has more owned skus than the current list.

我想知道IInAppBillingService方法(getSkuDetailsgetBuyIntentgetPurchases)中使用的“签名”和“签名列表”。

1 个答案:

答案 0 :(得分:2)

来自Android开发者网站的参考资料:

  

INAPP_DATA_SIGNATURE - 包含购买签名的字符串   开发人员使用其私钥签名的数据。数据   签名使用RSASSA-PKCS1-v1_5方案。

购买签名是通过使用与您的开发者帐户关联的私钥对INAPP_PURCHASE_DATA进行签名而创建的字符串。您可以使用签名来验证购买数据是否未以任何方式被篡改,并且用户实际购买了您的应用程序。

由于签名过程是使用私钥完成的,因此应在远程服务器上进行验证,而不要在设备本身上进行验证,因此如果您希望使用此安全功能,则需要实施自己的验证服务器。