我已经尝试了几天来解决这个问题,使用SDK附带的Dungeons演示代码.我试过谷歌寻求答案,但找不到答案.
android.test.purchased在控制台上创建的产品列表和已发布的订阅(我想要的应用程序的主要功能).但我仍然得到错误,Signature verification failed然后签名与数据不匹配.我怎么解决这个问题?
public static ArrayList<VerifiedPurchase> verifyPurchase(String signedData, String signature)
{
if (signedData == null) {
Log.e(TAG, "data is null");
return null;
}
if (Consts.DEBUG) {
Log.i(TAG, "signedData: " + signedData);
}
boolean verified = false;
if (!TextUtils.isEmpty(signature)) {
String base64EncodedPublicKey = "MIIBIjA....AQAB";
PublicKey key = Security.generatePublicKey(base64EncodedPublicKey);
verified = Security.verify(key, signedData, signature);
if (!verified) {
Log.w(TAG, "signature does not match data.");
return null;
}
}
}
public static boolean verify(PublicKey publicKey, String …Run Code Online (Sandbox Code Playgroud)