Files
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

74 lines
2.8 KiB
Java

package com.ea.nimble.mtx.googleplay.billing;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;
/* loaded from: classes2.dex */
class Security {
private static final String KEY_FACTORY_ALGORITHM = "RSA";
private static final String SIGNATURE_ALGORITHM = "SHA1withRSA";
private static final String TAG = "IABUtil/Security";
public static boolean verifyPurchase(String str, String str2, String str3) {
if (TextUtils.isEmpty(str2) || TextUtils.isEmpty(str) || TextUtils.isEmpty(str3)) {
Log.w(TAG, "Purchase verification failed: missing data.");
return false;
}
try {
return verify(generatePublicKey(str), str2, str3).booleanValue();
} catch (IOException e) {
Log.e(TAG, "Error generating PublicKey from encoded key: " + e.getMessage());
return false;
}
}
private static PublicKey generatePublicKey(String str) throws IOException {
try {
return KeyFactory.getInstance(KEY_FACTORY_ALGORITHM).generatePublic(new X509EncodedKeySpec(Base64.decode(str, 0)));
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (InvalidKeySpecException e2) {
String str2 = "Invalid key specification: " + e2;
Log.w(TAG, str2);
throw new IOException(str2);
}
}
private static Boolean verify(PublicKey publicKey, String str, String str2) {
try {
byte[] decode = Base64.decode(str2, 0);
try {
Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM);
signature.initVerify(publicKey);
signature.update(str.getBytes());
if (signature.verify(decode)) {
return Boolean.TRUE;
}
Log.w(TAG, "Signature verification failed...");
return Boolean.FALSE;
} catch (InvalidKeyException unused) {
Log.e(TAG, "Invalid key specification.");
return Boolean.FALSE;
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (SignatureException unused2) {
Log.e(TAG, "Signature exception.");
return Boolean.FALSE;
}
} catch (IllegalArgumentException unused3) {
Log.w(TAG, "Base64 decoding failed.");
return Boolean.FALSE;
}
}
}