// AssetBundleの復号化 private static AssetBundle DecryptingAssetBundle(AssetBundle bundle) { TextAsset textAsset = bundle.LoadAsset <TextAsset>(bundle.name); // nullチェック if (textAsset == null) { Debug.Log("[" + bundle.name + "]" + " inner asset is Null."); return(bundle); } bundle.Unload(false); byte[] decrypt = AESCryption.Decryption(textAsset.bytes); AssetBundle decryptBundle = AssetBundle.LoadFromMemory(decrypt); Debug.Log("[" + decryptBundle.name + "]" + " is decryped."); return(decryptBundle); }
static void Decryption() { // 保存先のパス設定 string outputPath = "AESCryption/Dencrypt"; if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } // エディタ上で選択されたオブジェクトを取得 Object[] objs = Selection.objects; // 復号化ファイルの保存 foreach (Object obj in objs) { TextAsset t = (TextAsset)obj; byte[] data = AESCryption.Decryption(t.bytes); string path = outputPath + "/" + t.name + ".bytes"; File.WriteAllBytes(path, data); } Debug.Log("[AESCryption]: Decryption completed."); }