using System; using System.Runtime.InteropServices; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines { // Token: 0x020016BA RID: 5818 [Token(Token = "0x20016BA")] [StructLayout(3)] public class IesEngine { // Token: 0x06009C0A RID: 39946 RVA: 0x00235240 File Offset: 0x00233440 [Token(Token = "0x6009C0A")] [Address(RVA = "0x2124FF0", Offset = "0x21239F0", VA = "0x182124FF0")] public IesEngine(IBasicAgreement agree, IDerivationFunction kdf, IMac mac) { this.agree = agree; this.kdf = kdf; this.mac = mac; byte[] array = new byte[0]; this.macBuf = array; } // Token: 0x06009C0B RID: 39947 RVA: 0x0023527C File Offset: 0x0023347C [Token(Token = "0x6009C0B")] [Address(RVA = "0x2124F50", Offset = "0x2123950", VA = "0x182124F50")] public IesEngine(IBasicAgreement agree, IDerivationFunction kdf, IMac mac, BufferedBlockCipher cipher) { this.agree = agree; this.kdf = kdf; this.mac = mac; byte[] array = new byte[0]; this.macBuf = array; this.cipher = 0; } // Token: 0x06009C0C RID: 39948 RVA: 0x002352C0 File Offset: 0x002334C0 [Token(Token = "0x6009C0C")] [Address(RVA = "0x2124C80", Offset = "0x2123680", VA = "0x182124C80", Slot = "4")] public virtual void Init(bool forEncryption, ICipherParameters privParameters, ICipherParameters pubParameters, ICipherParameters iesParameters) { this.forEncryption = forEncryption; this.privParam = privParameters; this.pubParam = pubParameters; this.param = 0; } // Token: 0x06009C0D RID: 39949 RVA: 0x002352EC File Offset: 0x002334EC [Token(Token = "0x6009C0D")] [Address(RVA = "0x21241E0", Offset = "0x2122BE0", VA = "0x1821241E0")] private byte[] DecryptBlock(byte[] in_enc, int inOff, int inLen, byte[] z) { /* An exception occurred when decompiling this method (06009C0D) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines.IesEngine::DecryptBlock(System.Byte[],System.Int32,System.Int32,System.Byte[]) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_130: stloc:InvalidCipherTextException(var_34_13A, newobj:InvalidCipherTextException(InvalidCipherTextException::.ctor, ldstr:string("Invalid MAC."))) } 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: 0x06009C0E RID: 39950 RVA: 0x00235434 File Offset: 0x00233634 [Token(Token = "0x6009C0E")] [Address(RVA = "0x21246D0", Offset = "0x21230D0", VA = "0x1821246D0")] private byte[] EncryptBlock(byte[] input, int inOff, int inLen, byte[] z) { int num; int num2; for (;;) { byte[] derivation = this.param.derivation; IesParameters iesParameters = this.param; num = iesParameters.macKeySize; if (this.cipher == (ulong)0L) { goto IL_A2; } if (iesParameters != 0) { num2 = 0; if (iesParameters != 0) { break; } } } num += typeof(IesWithCipherParameters).TypeHandle; KdfParameters kdfParameters; byte[] array = this.GenerateKdfBytes(kdfParameters, num2); string algorithmName = this.cipher.AlgorithmName; int blockSize = this.cipher.GetBlockSize(); byte[] array2 = new byte[inLen]; BufferedBlockCipher bufferedBlockCipher = this.cipher; BufferedBlockCipher bufferedBlockCipher2 = this.cipher; IMac mac = this.mac; byte[] array3 = new byte[0]; int num3 = 0; int num4 = 0; Array.Copy(array2, num4, array3, num3, inLen); IL_A2: IMac mac2 = this.mac; byte[] array4 = new byte[0]; int num5 = 0; if (inLen != 0) { num5++; while (num5 != inLen) { } } byte[] array5; KeyParameter keyParameter = new KeyParameter(array5, inLen, num); IesParameters iesParameters2 = this.param; IMac mac3 = this.mac; byte[] encoding = iesParameters2.encoding; IMac mac4 = this.mac; IMac mac5 = this.mac; int length = encoding.Length; IMac mac6 = this.mac; return array4; } // Token: 0x06009C0F RID: 39951 RVA: 0x00235554 File Offset: 0x00233754 [Token(Token = "0x6009C0F")] [Address(RVA = "0x2124B70", Offset = "0x2123570", VA = "0x182124B70")] private byte[] GenerateKdfBytes(KdfParameters kParam, int length) { byte[] array = new byte[length]; IDerivationFunction derivationFunction = this.kdf; IDerivationFunction derivationFunction2 = this.kdf; int num = 0; int length2 = array.Length; if (num < derivationFunction) { num += num; num++; } return array; } // Token: 0x06009C10 RID: 39952 RVA: 0x00235598 File Offset: 0x00233798 [Token(Token = "0x6009C10")] [Address(RVA = "0x2124D40", Offset = "0x2123740", VA = "0x182124D40", Slot = "5")] public virtual byte[] ProcessBlock(byte[] input, int inOff, int inLen) { int num; byte[] array3; do { num = 0; IBasicAgreement basicAgreement = this.agree; IBasicAgreement basicAgreement2 = this.agree; ICipherParameters cipherParameters = this.pubParam; if (num < basicAgreement) { num += num; num++; } IBasicAgreement basicAgreement3 = this.agree; byte[] array2; if (this.forEncryption) { byte[] array = this.EncryptBlock(input, inOff, inLen, array2); } array3 = this.DecryptBlock(input, inOff, inLen, array2); int length = array2.Length; int num2 = 0; Array.Clear(array2, num2, length); if (num != -1) { } } while (num != 0); return array3; } // Token: 0x0400665F RID: 26207 [global::Cpp2IlInjected.FieldOffset(Offset = "0x10")] [Token(Token = "0x400665F")] private readonly IBasicAgreement agree; // Token: 0x04006660 RID: 26208 [global::Cpp2IlInjected.FieldOffset(Offset = "0x18")] [Token(Token = "0x4006660")] private readonly IDerivationFunction kdf; // Token: 0x04006661 RID: 26209 [global::Cpp2IlInjected.FieldOffset(Offset = "0x20")] [Token(Token = "0x4006661")] private readonly IMac mac; // Token: 0x04006662 RID: 26210 [global::Cpp2IlInjected.FieldOffset(Offset = "0x28")] [Token(Token = "0x4006662")] private readonly BufferedBlockCipher cipher; // Token: 0x04006663 RID: 26211 [global::Cpp2IlInjected.FieldOffset(Offset = "0x30")] [Token(Token = "0x4006663")] private readonly byte[] macBuf; // Token: 0x04006664 RID: 26212 [global::Cpp2IlInjected.FieldOffset(Offset = "0x38")] [Token(Token = "0x4006664")] private bool forEncryption; // Token: 0x04006665 RID: 26213 [global::Cpp2IlInjected.FieldOffset(Offset = "0x40")] [Token(Token = "0x4006665")] private ICipherParameters privParam; // Token: 0x04006666 RID: 26214 [global::Cpp2IlInjected.FieldOffset(Offset = "0x48")] [Token(Token = "0x4006666")] private ICipherParameters pubParam; // Token: 0x04006667 RID: 26215 [global::Cpp2IlInjected.FieldOffset(Offset = "0x50")] [Token(Token = "0x4006667")] private IesParameters param; } }