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: 0x02001D6E RID: 7534
|
|
[Token(Token = "0x2001D6E")]
|
|
public class DesEngine : IBlockCipher
|
|
{
|
|
// Token: 0x0600BB35 RID: 47925 RVA: 0x00292138 File Offset: 0x00290338
|
|
[Token(Token = "0x600BB35")]
|
|
[Address(RVA = "0x411530", Offset = "0x410530", VA = "0x180411530", Slot = "10")]
|
|
public virtual int[] GetWorkingKey()
|
|
{
|
|
return this.workingKey;
|
|
}
|
|
|
|
// Token: 0x0600BB36 RID: 47926 RVA: 0x0029214C File Offset: 0x0029034C
|
|
[Token(Token = "0x600BB36")]
|
|
[Address(RVA = "0x27E9230", Offset = "0x27E8230", VA = "0x1827E9230", Slot = "11")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BB36)
|
|
|
|
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: 0x17001D65 RID: 7525
|
|
// (get) Token: 0x0600BB37 RID: 47927 RVA: 0x00292194 File Offset: 0x00290394
|
|
[Token(Token = "0x17001D65")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600BB37")]
|
|
[Address(RVA = "0x27E9820", Offset = "0x27E8820", VA = "0x1827E9820", Slot = "12")]
|
|
get
|
|
{
|
|
return "DES";
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001D66 RID: 7526
|
|
// (get) Token: 0x0600BB38 RID: 47928 RVA: 0x002921A8 File Offset: 0x002903A8
|
|
[Token(Token = "0x17001D66")]
|
|
public virtual bool IsPartialBlockOkay
|
|
{
|
|
[Token(Token = "0x600BB38")]
|
|
[Address(RVA = "0x424690", Offset = "0x423690", VA = "0x180424690", Slot = "13")]
|
|
get
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600BB39 RID: 47929 RVA: 0x002921B8 File Offset: 0x002903B8
|
|
[Token(Token = "0x600BB39")]
|
|
[Address(RVA = "0x681E00", Offset = "0x680E00", VA = "0x180681E00", Slot = "14")]
|
|
public virtual int GetBlockSize()
|
|
{
|
|
return 8;
|
|
}
|
|
|
|
// Token: 0x0600BB3A RID: 47930 RVA: 0x002921C8 File Offset: 0x002903C8
|
|
[Token(Token = "0x600BB3A")]
|
|
[Address(RVA = "0x27E93F0", Offset = "0x27E83F0", VA = "0x1827E93F0", Slot = "15")]
|
|
public virtual int ProcessBlock(byte[] input, int inOff, byte[] output, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BB3A)
|
|
|
|
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: 0x0600BB3B RID: 47931 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600BB3B")]
|
|
[Address(RVA = "0x4242D0", Offset = "0x4232D0", VA = "0x1804242D0", Slot = "16")]
|
|
public virtual void Reset()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600BB3C RID: 47932 RVA: 0x00292204 File Offset: 0x00290404
|
|
[Token(Token = "0x600BB3C")]
|
|
[Address(RVA = "0x27E8B00", Offset = "0x27E7B00", VA = "0x1827E8B00")]
|
|
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: 0x0600BB3D RID: 47933 RVA: 0x0029232C File Offset: 0x0029052C
|
|
[Token(Token = "0x600BB3D")]
|
|
[Address(RVA = "0x27E84B0", Offset = "0x27E74B0", VA = "0x1827E84B0")]
|
|
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: 0x0600BB3E RID: 47934 RVA: 0x002923A8 File Offset: 0x002905A8
|
|
[Token(Token = "0x600BB3E")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
public DesEngine()
|
|
{
|
|
this.Reset();
|
|
}
|
|
|
|
// Token: 0x0600BB3F RID: 47935 RVA: 0x002923BC File Offset: 0x002905BC
|
|
// Note: this type is marked as 'beforefieldinit'.
|
|
[Token(Token = "0x600BB3F")]
|
|
[Address(RVA = "0x27E9520", Offset = "0x27E8520", VA = "0x1827E9520")]
|
|
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: 0x04007604 RID: 30212
|
|
[Token(Token = "0x4007604")]
|
|
internal const int BLOCK_SIZE = 8;
|
|
|
|
// Token: 0x04007605 RID: 30213
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007605")]
|
|
private int[] workingKey;
|
|
|
|
// Token: 0x04007606 RID: 30214
|
|
[Token(Token = "0x4007606")]
|
|
private static readonly short[] bytebit;
|
|
|
|
// Token: 0x04007607 RID: 30215
|
|
[Token(Token = "0x4007607")]
|
|
private static readonly int[] bigbyte;
|
|
|
|
// Token: 0x04007608 RID: 30216
|
|
[Token(Token = "0x4007608")]
|
|
private static readonly byte[] pc1;
|
|
|
|
// Token: 0x04007609 RID: 30217
|
|
[Token(Token = "0x4007609")]
|
|
private static readonly byte[] totrot;
|
|
|
|
// Token: 0x0400760A RID: 30218
|
|
[Token(Token = "0x400760A")]
|
|
private static readonly byte[] pc2;
|
|
|
|
// Token: 0x0400760B RID: 30219
|
|
[Token(Token = "0x400760B")]
|
|
private static readonly uint[] SP1;
|
|
|
|
// Token: 0x0400760C RID: 30220
|
|
[Token(Token = "0x400760C")]
|
|
private static readonly uint[] SP2;
|
|
|
|
// Token: 0x0400760D RID: 30221
|
|
[Token(Token = "0x400760D")]
|
|
private static readonly uint[] SP3;
|
|
|
|
// Token: 0x0400760E RID: 30222
|
|
[Token(Token = "0x400760E")]
|
|
private static readonly uint[] SP4;
|
|
|
|
// Token: 0x0400760F RID: 30223
|
|
[Token(Token = "0x400760F")]
|
|
private static readonly uint[] SP5;
|
|
|
|
// Token: 0x04007610 RID: 30224
|
|
[Token(Token = "0x4007610")]
|
|
private static readonly uint[] SP6;
|
|
|
|
// Token: 0x04007611 RID: 30225
|
|
[Token(Token = "0x4007611")]
|
|
private static readonly uint[] SP7;
|
|
|
|
// Token: 0x04007612 RID: 30226
|
|
[Token(Token = "0x4007612")]
|
|
private static readonly uint[] SP8;
|
|
}
|
|
}
|