2015-04-26 49 views
0

此代碼是聯合「Google Play許可證驗證」資源中的示例代碼。無效的LVL密鑰!如何從團結得到LVL的android鍵?

我建立這個項目,並玩Android手機。 但它顯示「無效的LVL密鑰!」

我想,我必須改變後面的字符串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 >"; 

但是,我只知道m_Publickey_Base64的價值,來自google play market。

hmm ......你知道我在做什麼錯嗎? 我能做什麼?請幫幫我。

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

回答

0

的一部分,縱觀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?