Example #1
0
 public static string[] GetAvailableKeys(string keystore, string storepass)
 {
     if ((keystore.Length == 0) || (storepass.Length == 0))
     {
         return((string[])(s_AvailableKeyalias = null));
     }
     if ((s_AvailableKeyalias != null) && keystore.Equals(s_CurrentKeystore))
     {
         return(s_AvailableKeyalias);
     }
     s_CurrentKeystore = keystore;
     try
     {
         if (AndroidSDKTools.GetInstance() == null)
         {
             throw new UnityException("Unable to find Android SDK!");
         }
         return(s_AvailableKeyalias = AndroidSDKTools.GetInstanceOrThrowException().ReadAvailableKeys(keystore, storepass));
     }
     catch (Exception exception)
     {
         Debug.LogError(exception.ToString());
         return(null);
     }
 }
Example #2
0
        private bool CreateKey(string keystore, string storepass)
        {
            string[] array = new string[0];
            if (this.m_Name.Length != 0)
            {
                ArrayUtility.Add <string>(ref array, "CN=" + escapeDName(this.m_Name));
            }
            if (this.m_OrgUnit.Length != 0)
            {
                ArrayUtility.Add <string>(ref array, "OU=" + escapeDName(this.m_OrgUnit));
            }
            if (this.m_Organization.Length != 0)
            {
                ArrayUtility.Add <string>(ref array, "O=" + escapeDName(this.m_Organization));
            }
            if (this.m_City.Length != 0)
            {
                ArrayUtility.Add <string>(ref array, "L=" + escapeDName(this.m_City));
            }
            if (this.m_State.Length != 0)
            {
                ArrayUtility.Add <string>(ref array, "ST=" + escapeDName(this.m_State));
            }
            if (this.m_Country.Length != 0)
            {
                ArrayUtility.Add <string>(ref array, "C=" + escapeDName(this.m_Country));
            }
            string dname = string.Join(", ", array);

            try
            {
                AndroidSDKTools.GetInstanceOrThrowException().CreateKey(keystore, storepass, this.m_Alias, this.m_Password, dname, this.m_Validity * 0x16d);
                s_AvailableKeyalias = null;
            }
            catch (Exception exception)
            {
                Debug.LogError(exception.ToString());
                return(false);
            }
            return(true);
        }
Example #3
0
        public static void ShowAndroidKeystoreWindow(string company, string keystore, string storepass)
        {
            if (File.Exists(keystore))
            {
                try
                {
                    AndroidSDKTools.GetInstanceOrThrowException().ReadAvailableKeys(keystore, storepass);
                }
                catch (Exception exception)
                {
                    Debug.LogError(exception.ToString());
                    return;
                }
            }
            Rect rect = new Rect(100f, 100f, 500f, 330f);
            AndroidKeystoreWindow window = (AndroidKeystoreWindow)EditorWindow.GetWindowWithRect(typeof(AndroidKeystoreWindow), rect, true, EditorGUIUtility.TextContent("Create a new key").text);

            window.position = rect;
            window.m_Parent.window.m_DontSaveToLayout = true;
            window.m_Organization = company;
            window.m_Keystore     = keystore;
            window.m_StorePass    = storepass;
        }