Skip to content

Instantly share code, notes, and snippets.

@WcLyic WcLyic/t.c
Created Dec 19, 2017

Embed
What would you like to do?
// .net
public static byte[] DecryptBytes(byte[] message)
{
if (message == null || message.Length == 0)
{
return message;
}
byte[] result;
using (RijndaelManaged rijndaelManaged = new RijndaelManaged())
{
rijndaelManaged.Key = Encoding.UTF8.GetBytes("OTFjM2I3MzdlMzcxNjBkMmUxYTYxNmYx");
Debug.Log(rijndaelManaged.Key);
rijndaelManaged.IV = Convert.FromBase64String("2vYybHoCnSa9SD8Nu6ssAA==");
Debug.Log(rijndaelManaged.IV);
rijndaelManaged.Padding = PaddingMode.None;
Debug.Log(rijndaelManaged.Padding);
rijndaelManaged.Mode = CipherMode.ECB;
Debug.Log(rijndaelManaged.Mode);
using (MemoryStream memoryStream = new MemoryStream())
{
using (ICryptoTransform cryptoTransform = rijndaelManaged.CreateDecryptor())
{
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, cryptoTransform, CryptoStreamMode.Write))
{
cryptoStream.Write(message, 0, message.Length);
cryptoStream.FlushFinalBlock();
result = memoryStream.ToArray();
}
}
}
}
return result;
}
// il2cpp converted
// System.Byte[] Spine.Unity.Examples.SpineBeginnerTwo::DecryptBytes(System.Byte[])
extern Il2CppClass* RijndaelManaged_t1034060848_il2cpp_TypeInfo_var;
extern Il2CppClass* Encoding_t663144255_il2cpp_TypeInfo_var;
extern Il2CppClass* Debug_t1368543263_il2cpp_TypeInfo_var;
extern Il2CppClass* Convert_t2607082565_il2cpp_TypeInfo_var;
extern Il2CppClass* PaddingMode_t3032142640_il2cpp_TypeInfo_var;
extern Il2CppClass* CipherMode_t162592484_il2cpp_TypeInfo_var;
extern Il2CppClass* MemoryStream_t743994179_il2cpp_TypeInfo_var;
extern Il2CppClass* CryptoStream_t3531341937_il2cpp_TypeInfo_var;
extern Il2CppClass* IDisposable_t2427283555_il2cpp_TypeInfo_var;
extern Il2CppCodeGenString* _stringLiteral4235975035;
extern Il2CppCodeGenString* _stringLiteral4293549973;
extern const uint32_t SpineBeginnerTwo_DecryptBytes_m16726682_MetadataUsageId;
extern "C" ByteU5BU5D_t3397334013* SpineBeginnerTwo_DecryptBytes_m16726682 (Il2CppObject * __this /* static, unused */, ByteU5BU5D_t3397334013* ___message0, const MethodInfo* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (SpineBeginnerTwo_DecryptBytes_m16726682_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
ByteU5BU5D_t3397334013* V_0 = NULL;
RijndaelManaged_t1034060848 * V_1 = NULL;
MemoryStream_t743994179 * V_2 = NULL;
Il2CppObject * V_3 = NULL;
CryptoStream_t3531341937 * V_4 = NULL;
Exception_t1927440687 * __last_unhandled_exception = 0;
NO_UNUSED_WARNING (__last_unhandled_exception);
Exception_t1927440687 * __exception_local = 0;
NO_UNUSED_WARNING (__exception_local);
int32_t __leave_target = 0;
NO_UNUSED_WARNING (__leave_target);
{
ByteU5BU5D_t3397334013* L_0 = ___message0;
if (!L_0)
{
goto IL_000e;
}
}
{
ByteU5BU5D_t3397334013* L_1 = ___message0;
if ((((int32_t)((int32_t)(((Il2CppArray *)L_1)->max_length)))))
{
goto IL_0010;
}
}
IL_000e:
{
ByteU5BU5D_t3397334013* L_2 = ___message0;
return L_2;
}
IL_0010:
{
RijndaelManaged_t1034060848 * L_3 = (RijndaelManaged_t1034060848 *)il2cpp_codegen_object_new(RijndaelManaged_t1034060848_il2cpp_TypeInfo_var);
RijndaelManaged__ctor_m1723326849(L_3, /*hidden argument*/NULL);
V_1 = L_3;
}
IL_0016:
try
{ // begin try (depth: 1)
{
RijndaelManaged_t1034060848 * L_4 = V_1;
IL2CPP_RUNTIME_CLASS_INIT(Encoding_t663144255_il2cpp_TypeInfo_var);
Encoding_t663144255 * L_5 = Encoding_get_UTF8_m1752852937(NULL /*static, unused*/, /*hidden argument*/NULL);
ByteU5BU5D_t3397334013* L_6 = VirtFuncInvoker1< ByteU5BU5D_t3397334013*, String_t* >::Invoke(10 /* System.Byte[] System.Text.Encoding::GetBytes(System.String) */, L_5, _stringLiteral4235975035);
VirtActionInvoker1< ByteU5BU5D_t3397334013* >::Invoke(12 /* System.Void System.Security.Cryptography.SymmetricAlgorithm::set_Key(System.Byte[]) */, L_4, L_6);
RijndaelManaged_t1034060848 * L_7 = V_1;
ByteU5BU5D_t3397334013* L_8 = VirtFuncInvoker0< ByteU5BU5D_t3397334013* >::Invoke(11 /* System.Byte[] System.Security.Cryptography.SymmetricAlgorithm::get_Key() */, L_7);
IL2CPP_RUNTIME_CLASS_INIT(Debug_t1368543263_il2cpp_TypeInfo_var);
Debug_Log_m920475918(NULL /*static, unused*/, (Il2CppObject *)(Il2CppObject *)L_8, /*hidden argument*/NULL);
RijndaelManaged_t1034060848 * L_9 = V_1;
IL2CPP_RUNTIME_CLASS_INIT(Convert_t2607082565_il2cpp_TypeInfo_var);
ByteU5BU5D_t3397334013* L_10 = Convert_FromBase64String_m3629466114(NULL /*static, unused*/, _stringLiteral4293549973, /*hidden argument*/NULL);
VirtActionInvoker1< ByteU5BU5D_t3397334013* >::Invoke(10 /* System.Void System.Security.Cryptography.SymmetricAlgorithm::set_IV(System.Byte[]) */, L_9, L_10);
RijndaelManaged_t1034060848 * L_11 = V_1;
ByteU5BU5D_t3397334013* L_12 = VirtFuncInvoker0< ByteU5BU5D_t3397334013* >::Invoke(9 /* System.Byte[] System.Security.Cryptography.SymmetricAlgorithm::get_IV() */, L_11);
Debug_Log_m920475918(NULL /*static, unused*/, (Il2CppObject *)(Il2CppObject *)L_12, /*hidden argument*/NULL);
RijndaelManaged_t1034060848 * L_13 = V_1;
VirtActionInvoker1< int32_t >::Invoke(19 /* System.Void System.Security.Cryptography.SymmetricAlgorithm::set_Padding(System.Security.Cryptography.PaddingMode) */, L_13, 1);
RijndaelManaged_t1034060848 * L_14 = V_1;
int32_t L_15 = VirtFuncInvoker0< int32_t >::Invoke(18 /* System.Security.Cryptography.PaddingMode System.Security.Cryptography.SymmetricAlgorithm::get_Padding() */, L_14);
int32_t L_16 = L_15;
Il2CppObject * L_17 = Box(PaddingMode_t3032142640_il2cpp_TypeInfo_var, &L_16);
Debug_Log_m920475918(NULL /*static, unused*/, L_17, /*hidden argument*/NULL);
RijndaelManaged_t1034060848 * L_18 = V_1;
VirtActionInvoker1< int32_t >::Invoke(17 /* System.Void System.Security.Cryptography.SymmetricAlgorithm::set_Mode(System.Security.Cryptography.CipherMode) */, L_18, 2);
RijndaelManaged_t1034060848 * L_19 = V_1;
int32_t L_20 = VirtFuncInvoker0< int32_t >::Invoke(16 /* System.Security.Cryptography.CipherMode System.Security.Cryptography.SymmetricAlgorithm::get_Mode() */, L_19);
int32_t L_21 = L_20;
Il2CppObject * L_22 = Box(CipherMode_t162592484_il2cpp_TypeInfo_var, &L_21);
Debug_Log_m920475918(NULL /*static, unused*/, L_22, /*hidden argument*/NULL);
MemoryStream_t743994179 * L_23 = (MemoryStream_t743994179 *)il2cpp_codegen_object_new(MemoryStream_t743994179_il2cpp_TypeInfo_var);
MemoryStream__ctor_m1043059966(L_23, /*hidden argument*/NULL);
V_2 = L_23;
}
IL_0085:
try
{ // begin try (depth: 2)
{
RijndaelManaged_t1034060848 * L_24 = V_1;
Il2CppObject * L_25 = VirtFuncInvoker0< Il2CppObject * >::Invoke(20 /* System.Security.Cryptography.ICryptoTransform System.Security.Cryptography.SymmetricAlgorithm::CreateDecryptor() */, L_24);
V_3 = L_25;
}
IL_008c:
try
{ // begin try (depth: 3)
{
MemoryStream_t743994179 * L_26 = V_2;
Il2CppObject * L_27 = V_3;
CryptoStream_t3531341937 * L_28 = (CryptoStream_t3531341937 *)il2cpp_codegen_object_new(CryptoStream_t3531341937_il2cpp_TypeInfo_var);
CryptoStream__ctor_m2578098817(L_28, L_26, L_27, 1, /*hidden argument*/NULL);
V_4 = L_28;
}
IL_0096:
try
{ // begin try (depth: 4)
CryptoStream_t3531341937 * L_29 = V_4;
ByteU5BU5D_t3397334013* L_30 = ___message0;
ByteU5BU5D_t3397334013* L_31 = ___message0;
VirtActionInvoker3< ByteU5BU5D_t3397334013*, int32_t, int32_t >::Invoke(18 /* System.Void System.IO.Stream::Write(System.Byte[],System.Int32,System.Int32) */, L_29, L_30, 0, (((int32_t)((int32_t)(((Il2CppArray *)L_31)->max_length)))));
CryptoStream_t3531341937 * L_32 = V_4;
CryptoStream_FlushFinalBlock_m3450379637(L_32, /*hidden argument*/NULL);
MemoryStream_t743994179 * L_33 = V_2;
ByteU5BU5D_t3397334013* L_34 = VirtFuncInvoker0< ByteU5BU5D_t3397334013* >::Invoke(25 /* System.Byte[] System.IO.MemoryStream::ToArray() */, L_33);
V_0 = L_34;
IL2CPP_LEAVE(0xC4, FINALLY_00b5);
} // end try (depth: 4)
catch(Il2CppExceptionWrapper& e)
{
__last_unhandled_exception = (Exception_t1927440687 *)e.ex;
goto FINALLY_00b5;
}
FINALLY_00b5:
{ // begin finally (depth: 4)
{
CryptoStream_t3531341937 * L_35 = V_4;
if (!L_35)
{
goto IL_00c3;
}
}
IL_00bc:
{
CryptoStream_t3531341937 * L_36 = V_4;
InterfaceActionInvoker0::Invoke(0 /* System.Void System.IDisposable::Dispose() */, IDisposable_t2427283555_il2cpp_TypeInfo_var, L_36);
}
IL_00c3:
{
IL2CPP_END_FINALLY(181)
}
} // end finally (depth: 4)
IL2CPP_CLEANUP(181)
{
IL2CPP_JUMP_TBL(0xC4, IL_00c4)
IL2CPP_RETHROW_IF_UNHANDLED(Exception_t1927440687 *)
}
IL_00c4:
{
IL2CPP_LEAVE(0xD6, FINALLY_00c9);
}
} // end try (depth: 3)
catch(Il2CppExceptionWrapper& e)
{
__last_unhandled_exception = (Exception_t1927440687 *)e.ex;
goto FINALLY_00c9;
}
FINALLY_00c9:
{ // begin finally (depth: 3)
{
Il2CppObject * L_37 = V_3;
if (!L_37)
{
goto IL_00d5;
}
}
IL_00cf:
{
Il2CppObject * L_38 = V_3;
InterfaceActionInvoker0::Invoke(0 /* System.Void System.IDisposable::Dispose() */, IDisposable_t2427283555_il2cpp_TypeInfo_var, L_38);
}
IL_00d5:
{
IL2CPP_END_FINALLY(201)
}
} // end finally (depth: 3)
IL2CPP_CLEANUP(201)
{
IL2CPP_JUMP_TBL(0xD6, IL_00d6)
IL2CPP_RETHROW_IF_UNHANDLED(Exception_t1927440687 *)
}
IL_00d6:
{
IL2CPP_LEAVE(0xE8, FINALLY_00db);
}
} // end try (depth: 2)
catch(Il2CppExceptionWrapper& e)
{
__last_unhandled_exception = (Exception_t1927440687 *)e.ex;
goto FINALLY_00db;
}
FINALLY_00db:
{ // begin finally (depth: 2)
{
MemoryStream_t743994179 * L_39 = V_2;
if (!L_39)
{
goto IL_00e7;
}
}
IL_00e1:
{
MemoryStream_t743994179 * L_40 = V_2;
InterfaceActionInvoker0::Invoke(0 /* System.Void System.IDisposable::Dispose() */, IDisposable_t2427283555_il2cpp_TypeInfo_var, L_40);
}
IL_00e7:
{
IL2CPP_END_FINALLY(219)
}
} // end finally (depth: 2)
IL2CPP_CLEANUP(219)
{
IL2CPP_JUMP_TBL(0xE8, IL_00e8)
IL2CPP_RETHROW_IF_UNHANDLED(Exception_t1927440687 *)
}
IL_00e8:
{
IL2CPP_LEAVE(0xFA, FINALLY_00ed);
}
} // end try (depth: 1)
catch(Il2CppExceptionWrapper& e)
{
__last_unhandled_exception = (Exception_t1927440687 *)e.ex;
goto FINALLY_00ed;
}
FINALLY_00ed:
{ // begin finally (depth: 1)
{
RijndaelManaged_t1034060848 * L_41 = V_1;
if (!L_41)
{
goto IL_00f9;
}
}
IL_00f3:
{
RijndaelManaged_t1034060848 * L_42 = V_1;
InterfaceActionInvoker0::Invoke(0 /* System.Void System.IDisposable::Dispose() */, IDisposable_t2427283555_il2cpp_TypeInfo_var, L_42);
}
IL_00f9:
{
IL2CPP_END_FINALLY(237)
}
} // end finally (depth: 1)
IL2CPP_CLEANUP(237)
{
IL2CPP_JUMP_TBL(0xFA, IL_00fa)
IL2CPP_RETHROW_IF_UNHANDLED(Exception_t1927440687 *)
}
IL_00fa:
{
ByteU5BU5D_t3397334013* L_43 = V_0;
return L_43;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.