此代码是统一的“ Google Play许可证验证”资产中的示例代码。
我建立了这个项目,然后播放Android手机。但是,它告诉我“无效的LVL密钥!”
我认为,我必须更改跟随字符串的字符串。
private string m_PublicKey_Base64 = "< set Base64 encoding RSA public key >";
private string m_PublicKey_Modulus_Base64 = "<Set to output from SimpleParseASN1>";
private string m_PublicKey_Exponent_Base64 = "< .. and here >";
但是,我只知道Google Play市场的m_Publickey_Base64
值。
嗯……你知道我在做什么错吗?我能做什么?请帮助我。
这是CehckLBLButton示例源的一部分
public class CheckLVLButton : MonoBehaviour
{
/*
* This is the Java service binder classes.jar
*/
public TextAsset ServiceBinder;
/*
* Use the public LVL key from the Android Market publishing section here.
*/
private string m_PublicKey_Base64 = "< set Base64 encoding RSA public key >";
/*
* Consider storing the public key as RSAParameters.Modulus/.Exponent rather than Base64 to prevent the ASN1 parsing..
* These are printed to the logcat below.
*/
private string m_PublicKey_Modulus_Base64 = "<Set to output from SimpleParseASN1>";
private string m_PublicKey_Exponent_Base64 = "< .. and here >";
查看code on github的Start()函数:
// Either parse the ASN1-formatted public LVL key at runtime (only available when stripping is disabled)..
RSA.SimpleParseASN1(m_PublicKey_Base64, ref m_PublicKey.Modulus, ref m_PublicKey.Exponent);
m_PublicKey_Modulus_Base64 = System.Convert.ToBase64String(m_PublicKey.Modulus);
m_PublicKey_Exponent_Base64 = System.Convert.ToBase64String(m_PublicKey.Exponent);
// .. and check the logcat for these values ...
Debug.Log("private string m_PublicKey_Modulus_Base64 = \"" + m_PublicKey_Modulus_Base64 + "\";");
Debug.Log("private string m_PublicKey_Exponent_Base64 = \"" + m_PublicKey_Exponent_Base64 + "\";");
// .. or use pre-parsed keys (and remove the code above).
m_PublicKey.Modulus = System.Convert.FromBase64String(m_PublicKey_Modulus_Base64);
m_PublicKey.Exponent = System.Convert.FromBase64String(m_PublicKey_Exponent_Base64);
如果替换这些值
private string m_PublicKey_Modulus_Base64 = "<Set to output from SimpleParseASN1>";
private string m_PublicKey_Exponent_Base64 = "< .. and here >";
使用logcat中的实际字符串,您可以删除对SimpleParseASN1()的调用以及整个第一部分,并启用剥离。但是您可以跳过这些值,并且在指定了m_Publickey_Base64的情况下,它应该可以直接使用。
要了解您的应用程序出了什么问题,您可以共享logcat吗?
我有同样的问题,该按钮仅显示无效的LVL键!检查来源...但是我说对了,所以我真的不知道问题出在哪里。
我什至重新编译了Java源代码并将新的classes_jar.txt附加到CheckLVLButton脚本,但是仍然出现此错误。
并且当我尝试使用Visual Studio在Android上对其进行调试时,出现ServiceBinder为null的错误。