0

this code is Sample code in unity "Google Play License Verification" asset.

I build this project, and play form android phone. but, it show me "Invalid LVL key!"

I think, I have to change follow string varibale.

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 >";

BUT, I just know value that m_Publickey_Base64, from google play market.

hmm...... Do you know what i'm doing wrong?? what can i do? please help me.

this is part of CehckLBLButton sample source

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 >";
rene
  • 41,474
  • 78
  • 114
  • 152
Ares
  • 1

1 Answers1

0

Looking at the code on github, Start() function:

    // 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); 

If you replace these values

private string m_PublicKey_Modulus_Base64 = "<Set to output from SimpleParseASN1>";
private string m_PublicKey_Exponent_Base64 = "< .. and here >";

with actual string from logcat, you can delete the call to SimpleParseASN1() and the whole first section and enable stripping. But you can skip these values, and it should work out-of-box given that you specified m_Publickey_Base64.

To understand what's going wrong with your app, could you share the logcat?

Over17
  • 961
  • 7
  • 8