306 lines
15 KiB
C#
306 lines
15 KiB
C#
using System;
|
|
using System.Runtime.CompilerServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
|
{
|
|
// Token: 0x02001C8E RID: 7310
|
|
[Token(Token = "0x2001C8E")]
|
|
public class DesEngine : IBlockCipher
|
|
{
|
|
// Token: 0x0600B767 RID: 46951 RVA: 0x0028902C File Offset: 0x0028722C
|
|
[Token(Token = "0x600B767")]
|
|
[Address(RVA = "0x3F6E20", Offset = "0x3F5C20", VA = "0x1803F6E20", Slot = "10")]
|
|
public virtual int[] GetWorkingKey()
|
|
{
|
|
return this.workingKey;
|
|
}
|
|
|
|
// Token: 0x0600B768 RID: 46952 RVA: 0x00289040 File Offset: 0x00287240
|
|
[Token(Token = "0x600B768")]
|
|
[Address(RVA = "0x1DC6D70", Offset = "0x1DC5B70", VA = "0x181DC6D70", Slot = "11")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B768)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.DesEngine::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_28:
|
|
stloc:ArgumentException(var_6_39, newobj:ArgumentException(ArgumentException::.ctor, call:string(string::Concat, ldstr:string("invalid parameter passed to DES init - "), ldloc:string(var_5))))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x17001CC8 RID: 7368
|
|
// (get) Token: 0x0600B769 RID: 46953 RVA: 0x00289088 File Offset: 0x00287288
|
|
[Token(Token = "0x17001CC8")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B769")]
|
|
[Address(RVA = "0x1DC7360", Offset = "0x1DC6160", VA = "0x181DC7360", Slot = "12")]
|
|
get
|
|
{
|
|
return "DES";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001CC9 RID: 7369
|
|
// (get) Token: 0x0600B76A RID: 46954 RVA: 0x0028909C File Offset: 0x0028729C
|
|
[Token(Token = "0x17001CC9")]
|
|
public virtual bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x600B76A")]
|
|
[Address(RVA = "0x403930", Offset = "0x402730", VA = "0x180403930", Slot = "13")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B76B RID: 46955 RVA: 0x002890AC File Offset: 0x002872AC
|
|
[Token(Token = "0x600B76B")]
|
|
[Address(RVA = "0x4101D0", Offset = "0x40EFD0", VA = "0x1804101D0", Slot = "14")]
|
|
public virtual int GetBlockSize()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x0600B76C RID: 46956 RVA: 0x002890BC File Offset: 0x002872BC
|
|
[Token(Token = "0x600B76C")]
|
|
[Address(RVA = "0x1DC6F30", Offset = "0x1DC5D30", VA = "0x181DC6F30", Slot = "15")]
|
|
public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B76C)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.DesEngine::ProcessBlock(System.Byte[],System.Int32,System.Byte[],System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_21:
|
|
stloc:InvalidOperationException(var_4_2B, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("DES engine not initialised")))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600B76D RID: 46957 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600B76D")]
|
|
[Address(RVA = "0x402080", Offset = "0x400E80", VA = "0x180402080", Slot = "16")]
|
|
public virtual void Reset()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600B76E RID: 46958 RVA: 0x002890F8 File Offset: 0x002872F8
|
|
[Token(Token = "0x600B76E")]
|
|
[Address(RVA = "0x1DC6640", Offset = "0x1DC5440", VA = "0x181DC6640")]
|
|
protected static int[] GenerateWorkingKey(bool encrypting, byte[] key)
|
|
{
|
|
int[] array = new int[32];
|
|
bool[] array2 = new bool[56];
|
|
bool[] array3 = new bool[56];
|
|
int num = 0;
|
|
byte[] array4 = DesEngine.pc1;
|
|
short[] array5 = DesEngine.bytebit;
|
|
num++;
|
|
array[0] = num;
|
|
array[0] = num;
|
|
byte[] array6 = DesEngine.totrot;
|
|
int length = array2.Length;
|
|
byte b = (byte)((int)b + num);
|
|
num++;
|
|
byte[] array7 = DesEngine.totrot;
|
|
int length2 = array2.Length;
|
|
uint num2;
|
|
byte b2 = (byte)((uint)b2 + num2);
|
|
num2 += (uint)1;
|
|
byte b3 = DesEngine.pc2[num];
|
|
if ("{il2cpp array field local7->}" != (ulong)0L)
|
|
{
|
|
int num3 = DesEngine.bigbyte[num];
|
|
array[0] = num3;
|
|
}
|
|
byte[] array8 = DesEngine.pc2;
|
|
if ("{il2cpp array field local7->}" != (ulong)0L)
|
|
{
|
|
int num4 = DesEngine.bigbyte[num];
|
|
array[0] = num4;
|
|
}
|
|
num++;
|
|
num++;
|
|
uint num5;
|
|
if (num5 > (uint)(-2))
|
|
{
|
|
}
|
|
int num6 = 0;
|
|
int num7 = array.Length;
|
|
int num8;
|
|
num7 = num8;
|
|
array[0] = num8;
|
|
num6 += 2;
|
|
array[0] = num7;
|
|
while (num6 != 32)
|
|
{
|
|
}
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x0600B76F RID: 46959 RVA: 0x00289220 File Offset: 0x00287420
|
|
[Token(Token = "0x600B76F")]
|
|
[Address(RVA = "0x1DC5FF0", Offset = "0x1DC4DF0", VA = "0x181DC5FF0")]
|
|
internal static void DesFunc(int[] wKey, byte[] input, int inOff, byte[] outBytes, int outOff)
|
|
{
|
|
uint num = Pack.BE_To_UInt32(input, inOff);
|
|
uint num2 = Pack.BE_To_UInt32(input, inOff);
|
|
int num3 = 0;
|
|
uint[] sp = DesEngine.SP7;
|
|
uint[] sp2 = DesEngine.SP5;
|
|
uint[] sp3 = DesEngine.SP3;
|
|
uint[] sp4 = DesEngine.SP1;
|
|
uint[] sp5 = DesEngine.SP8;
|
|
uint[] sp6 = DesEngine.SP6;
|
|
uint[] sp7 = DesEngine.SP4;
|
|
uint[] sp8 = DesEngine.SP2;
|
|
num3 += 4;
|
|
}
|
|
|
|
// Token: 0x0600B770 RID: 46960 RVA: 0x0028929C File Offset: 0x0028749C
|
|
[Token(Token = "0x600B770")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
public DesEngine()
|
|
{
|
|
this.Reset();
|
|
}
|
|
|
|
// Token: 0x0600B771 RID: 46961 RVA: 0x002892B0 File Offset: 0x002874B0
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600B771")]
|
|
[Address(RVA = "0x1DC7060", Offset = "0x1DC5E60", VA = "0x181DC7060")]
|
|
static DesEngine()
|
|
{
|
|
short[] array = new short[8];
|
|
RuntimeHelpers.InitializeArray(array, fieldof(<PrivateImplementationDetails>.4FFC8339E09825A68B861995F9C660EB11DBF13D).FieldHandle);
|
|
DesEngine.bytebit = array;
|
|
int[] array2 = new int[24];
|
|
RuntimeHelpers.InitializeArray(array2, fieldof(<PrivateImplementationDetails>.C105B70BED997DB5D36E1D2E84C1EFCB445A428C).FieldHandle);
|
|
DesEngine.bigbyte = array2;
|
|
byte[] array3 = new byte[56];
|
|
RuntimeHelpers.InitializeArray(array3, fieldof(<PrivateImplementationDetails>.DC2B830D8CD59AD6A4E4332D21CA0DCA2821AD82).FieldHandle);
|
|
DesEngine.pc1 = array3;
|
|
byte[] array4 = new byte[16];
|
|
RuntimeHelpers.InitializeArray(array4, fieldof(<PrivateImplementationDetails>.B4FBD02AAB5B16E0F4BD858DA5D9E348F3CE501D).FieldHandle);
|
|
DesEngine.totrot = array4;
|
|
byte[] array5 = new byte[48];
|
|
RuntimeHelpers.InitializeArray(array5, fieldof(<PrivateImplementationDetails>.62BAB0F245E66C3EB982CF5A7015F0A7C3382283).FieldHandle);
|
|
DesEngine.pc2 = array5;
|
|
uint[] array6 = new uint[64];
|
|
RuntimeHelpers.InitializeArray(array6, fieldof(<PrivateImplementationDetails>.04B9E6B1364BBA4125AE2866E09C57C9E8CD6DA6).FieldHandle);
|
|
DesEngine.SP1 = array6;
|
|
uint[] array7 = new uint[64];
|
|
RuntimeHelpers.InitializeArray(array7, fieldof(<PrivateImplementationDetails>.3D6EB645BC212077C1B37A3A32CA2A62F7B39018).FieldHandle);
|
|
DesEngine.SP2 = array7;
|
|
uint[] array8 = new uint[64];
|
|
RuntimeHelpers.InitializeArray(array8, fieldof(<PrivateImplementationDetails>.821D1E62CD072AE9EC73D238C7DE19C5C5F3A7D8).FieldHandle);
|
|
DesEngine.SP3 = array8;
|
|
uint[] array9 = new uint[64];
|
|
RuntimeHelpers.InitializeArray(array9, fieldof(<PrivateImplementationDetails>.64354464C9074B5BB4369689AAA131961CD1EF19).FieldHandle);
|
|
DesEngine.SP4 = array9;
|
|
uint[] array10 = new uint[64];
|
|
RuntimeHelpers.InitializeArray(array10, fieldof(<PrivateImplementationDetails>.3F653EBF39CFCB2FD7FF335DC96E82F3CDFDF0C7).FieldHandle);
|
|
DesEngine.SP5 = array10;
|
|
uint[] array11 = new uint[64];
|
|
RuntimeHelpers.InitializeArray(array11, fieldof(<PrivateImplementationDetails>.6D7292FF64ED402BBFFF5E7534C0980BEBF0EEB1).FieldHandle);
|
|
DesEngine.SP6 = array11;
|
|
uint[] array12 = new uint[64];
|
|
RuntimeHelpers.InitializeArray(array12, fieldof(<PrivateImplementationDetails>.FC9EEBC457831129D4AF4FF84333B481F4BED60E).FieldHandle);
|
|
DesEngine.SP7 = array12;
|
|
uint[] array13 = new uint[64];
|
|
RuntimeHelpers.InitializeArray(array13, fieldof(<PrivateImplementationDetails>.4C44594E2C603D85EC6195B1A7A6C5876CBB58E2).FieldHandle);
|
|
DesEngine.SP8 = array13;
|
|
}
|
|
|
|
// Token: 0x0400744B RID: 29771
|
|
[Token(Token = "0x400744B")]
|
|
internal const int BLOCK_SIZE = 8;
|
|
|
|
// Token: 0x0400744C RID: 29772
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400744C")]
|
|
private int[] workingKey;
|
|
|
|
// Token: 0x0400744D RID: 29773
|
|
[Token(Token = "0x400744D")]
|
|
private static readonly short[] bytebit;
|
|
|
|
// Token: 0x0400744E RID: 29774
|
|
[Token(Token = "0x400744E")]
|
|
private static readonly int[] bigbyte;
|
|
|
|
// Token: 0x0400744F RID: 29775
|
|
[Token(Token = "0x400744F")]
|
|
private static readonly byte[] pc1;
|
|
|
|
// Token: 0x04007450 RID: 29776
|
|
[Token(Token = "0x4007450")]
|
|
private static readonly byte[] totrot;
|
|
|
|
// Token: 0x04007451 RID: 29777
|
|
[Token(Token = "0x4007451")]
|
|
private static readonly byte[] pc2;
|
|
|
|
// Token: 0x04007452 RID: 29778
|
|
[Token(Token = "0x4007452")]
|
|
private static readonly uint[] SP1;
|
|
|
|
// Token: 0x04007453 RID: 29779
|
|
[Token(Token = "0x4007453")]
|
|
private static readonly uint[] SP2;
|
|
|
|
// Token: 0x04007454 RID: 29780
|
|
[Token(Token = "0x4007454")]
|
|
private static readonly uint[] SP3;
|
|
|
|
// Token: 0x04007455 RID: 29781
|
|
[Token(Token = "0x4007455")]
|
|
private static readonly uint[] SP4;
|
|
|
|
// Token: 0x04007456 RID: 29782
|
|
[Token(Token = "0x4007456")]
|
|
private static readonly uint[] SP5;
|
|
|
|
// Token: 0x04007457 RID: 29783
|
|
[Token(Token = "0x4007457")]
|
|
private static readonly uint[] SP6;
|
|
|
|
// Token: 0x04007458 RID: 29784
|
|
[Token(Token = "0x4007458")]
|
|
private static readonly uint[] SP7;
|
|
|
|
// Token: 0x04007459 RID: 29785
|
|
[Token(Token = "0x4007459")]
|
|
private static readonly uint[] SP8;
|
|
}
|
|
}
|