2

当用户购买产品时,我使用网络服务来验证购买,为了防止重放攻击,我在购买中添加了一个(nonce)开发人员有效负载。它按预期工作。

但是恢复交易呢?我可以从本地库存中获取签名数据和签名以及所有其他信息(通过在 IabHelper 中调用 queryPurchases()),但我无法在任何地方设置新的开发人员有效负载,因此我无法在我的 web 服务上验证它。

如何安全地恢复交易?

帮助将不胜感激...

编辑:我应该坚持使用iab v2来恢复交易吗?

4

2 回答 2

1

因此,据我所知,这是一个未解决的安全问题,它损害了应用内计费 api v3 的安全性。无法安全地(使用 Web 服务验证)在应用程序计费 api v3 中恢复购买。

于 2013-06-11T08:24:50.170 回答
0

在撰写本文时,Google Play 计费库示例应用程序在查询购买的商品时检索开发人员有效负载以进行验证。代码如下所示:

// Listener that's called when we finish querying the items and subscriptions we own
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
    public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
        Log.d(TAG, "Query inventory finished.");

        .
        .
        .

        // Do we have the premium upgrade?
        Purchase premiumPurchase = inventory.getPurchase(SKU_PREMIUM);
        mIsPremium = (premiumPurchase != null && verifyDeveloperPayload(premiumPurchase));
        Log.d(TAG, "User is " + (mIsPremium ? "PREMIUM" : "NOT PREMIUM"));

        .
        .
        .
}
于 2014-01-12T00:47:31.270 回答