安全 API 密钥 Android [英] Secure API Key Android

查看:50
本文介绍了安全 API 密钥 Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个使用 Google 的 Blogger API 的项目.前天(星期六)有人攻击了我的应用程序并抢走了 API Key,我每天访问帖子的限制是 100,000(100K/24 小时).我在星期六达到了限制(我怀疑那些是使用我的 API 密钥进行的欺诈点击,因为我只有大约 4K 客户使用该应用程序,我将 API 密钥嵌入到客户端代码中).

I am currently working on a project which uses Blogger API from Google. Day before yesterday (saturday) someone attacked my application and grab the API Key, My daily limit for accessing posts is 100,000 (100K/24 hrs). I hit limit on Saturday (I suspect that those were fraudulent clicks made using my API key, since I've only around 4K customers using the application, I embedded the API key in client side code).

此后,在五分钟内 API 限制再次达到(24 小时后)5K.所以我删除了 API 密钥并生成了一个新的.

After that, In five minutes API limit reached again (after 24 hrs) 5K. So I deleted the API key and generated a new one.

我的问题是如何在客户端代码中保护我的新 API 密钥,以便攻击者无法访问 API 密钥或至少某些方法来间接使用客户端代码中的 API 密钥.

My question is how can I secure my new API Key in client code, so that no attacker can gain access to API key or at least some method to indirectly use the API Key in Client Code.

推荐答案

Google API 控制台可让您将 API 密钥绑定到应用的一组签名证书.
如果您将 API 密钥限制为几个证书,则该 API 对攻击者来说应该是无用的.(只要你保密你的私钥.)

The Google API console lets you bind your API key to a set of signing certificates of the app.
If you limit the API key to a few certificates, the API should be useless to an attacker. (As long as you keep your private key secret.)

这篇关于安全 API 密钥 Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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