//[MenuItem("Hugula AES/GenerateIV", false, 13)]
    public static void GenerateIV()
    {
        using (System.Security.Cryptography.RijndaelManaged myRijndael = new System.Security.Cryptography.RijndaelManaged()) {
            myRijndael.GenerateIV();
            byte[] IV = myRijndael.IV;

            KeyVData KeyScri = ScriptableObject.CreateInstance <KeyVData>();
            KeyScri.IV = IV;
            AssetDatabase.CreateAsset(KeyScri, "Assets/Config/K81.asset");
            Debug.Log("IV Generate " + IV.Length);
        }
    }
    //[MenuItem("Hugula AES/GenerateKey", false, 12)]
    public static void GenerateKey()
    {
        using (System.Security.Cryptography.RijndaelManaged myRijndael = new System.Security.Cryptography.RijndaelManaged()) {
            myRijndael.GenerateKey();
            byte[] Key = myRijndael.Key;

            KeyVData KeyScri = ScriptableObject.CreateInstance <KeyVData>();
            KeyScri.KEY = Key;
            AssetDatabase.CreateAsset(KeyScri, "Assets/Config/I81.asset");

            Debug.Log("key Generate " + Key.Length);
        }
    }
Beispiel #3
0
    public static void GenerateKey()
    {
        CheckDirectory(Path.Combine(Application.dataPath, "Config"));
        using (System.Security.Cryptography.RijndaelManaged myRijndael = new System.Security.Cryptography.RijndaelManaged())
        {
            myRijndael.GenerateKey();
            byte[] key = myRijndael.Key;
            byte[] IV  = myRijndael.IV;

            KeyVData keyScri = ScriptableObject.CreateInstance <KeyVData>();
            keyScri.KEY = key;
            keyScri.IV  = IV;
            AssetDatabase.CreateAsset(keyScri, "Assets/Resources/des.asset");

            Debug.Log("key Generate " + key.Length);
        }
    }
Beispiel #4
0
    static byte[] GetIV()
    {
        KeyVData kv = (KeyVData)AssetDatabase.LoadAssetAtPath("Assets/Config/K81.asset", typeof(KeyVData));

        return(kv.IV);
    }