来自 Android In App Billing 版本 3 (TrivialDrive) 示例应用程序附带 sdk
MainActivity.java
/* base64EncodedPublicKey should be YOUR APPLICATION'S PUBLIC KEY
* (that you got from the Google Play developer console). This is not your
* developer public key, it's the *app-specific* public key.
*
* Instead of just storing the entire literal string here embedded in the
* program, construct the key at runtime from pieces or
* use bit manipulation (for example, XOR with some other string) to hide
* the actual key. The key itself is not secret information, but we don't
* want to make it easy for an attacker to replace the public key with one
* of their own and then fake messages from the server.
*/
String base64EncodedPublicKey = "CONSTRUCT_YOUR_KEY_AND_PLACE_IT_HERE";
好吧,我不确定我是否了解此安全措施。我知道如何从 Google Play Developer Console 获取应用程序公钥(已经是 base 64 编码)。
我不明白的是这部分
/* Instead of just storing the entire literal string here embedded in the
* program, construct the key at runtime from pieces or
* use bit manipulation (for example, XOR with some other string) to hide
* the actual key
*/
据我所知,这个公钥是一个常量字符串,是谷歌在应用程序上传过程中给出的。
我们如何使用任何位操作过程以编程方式创建相同的密钥?以前有人做过吗?有没有关于如何做到这一点的示例代码?