using System; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines { // Token: 0x02001D77 RID: 7543 [Token(Token = "0x2001D77")] public class IesEngine { // Token: 0x0600BBB2 RID: 48050 RVA: 0x00295A00 File Offset: 0x00293C00 [Token(Token = "0x600BBB2")] [Address(RVA = "0x27F4D30", Offset = "0x27F3D30", VA = "0x1827F4D30")] 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: 0x0600BBB3 RID: 48051 RVA: 0x00295A3C File Offset: 0x00293C3C [Token(Token = "0x600BBB3")] [Address(RVA = "0x27F4C90", Offset = "0x27F3C90", VA = "0x1827F4C90")] 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: 0x0600BBB4 RID: 48052 RVA: 0x00295A80 File Offset: 0x00293C80 [Token(Token = "0x600BBB4")] [Address(RVA = "0x27F49E0", Offset = "0x27F39E0", VA = "0x1827F49E0", 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: 0x0600BBB5 RID: 48053 RVA: 0x00295AAC File Offset: 0x00293CAC [Token(Token = "0x600BBB5")] [Address(RVA = "0x27F3F40", Offset = "0x27F2F40", VA = "0x1827F3F40")] private byte[] DecryptBlock(byte[] in_enc, int inOff, int inLen, byte[] z) { /* An exception occurred when decompiling this method (0600BBB5) 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: 0x0600BBB6 RID: 48054 RVA: 0x00295BF4 File Offset: 0x00293DF4 [Token(Token = "0x600BBB6")] [Address(RVA = "0x27F4430", Offset = "0x27F3430", VA = "0x1827F4430")] 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: 0x0600BBB7 RID: 48055 RVA: 0x00295D14 File Offset: 0x00293F14 [Token(Token = "0x600BBB7")] [Address(RVA = "0x27F48D0", Offset = "0x27F38D0", VA = "0x1827F48D0")] 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: 0x0600BBB8 RID: 48056 RVA: 0x00295D58 File Offset: 0x00293F58 [Token(Token = "0x600BBB8")] [Address(RVA = "0x27F4AA0", Offset = "0x27F3AA0", VA = "0x1827F4AA0", 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); } while (num != 0); return array3; } // Token: 0x0400765B RID: 30299 [FieldOffset(Offset = "0x10")] [Token(Token = "0x400765B")] private readonly IBasicAgreement agree; // Token: 0x0400765C RID: 30300 [FieldOffset(Offset = "0x18")] [Token(Token = "0x400765C")] private readonly IDerivationFunction kdf; // Token: 0x0400765D RID: 30301 [FieldOffset(Offset = "0x20")] [Token(Token = "0x400765D")] private readonly IMac mac; // Token: 0x0400765E RID: 30302 [FieldOffset(Offset = "0x28")] [Token(Token = "0x400765E")] private readonly BufferedBlockCipher cipher; // Token: 0x0400765F RID: 30303 [FieldOffset(Offset = "0x30")] [Token(Token = "0x400765F")] private readonly byte[] macBuf; // Token: 0x04007660 RID: 30304 [FieldOffset(Offset = "0x38")] [Token(Token = "0x4007660")] private bool forEncryption; // Token: 0x04007661 RID: 30305 [FieldOffset(Offset = "0x40")] [Token(Token = "0x4007661")] private ICipherParameters privParam; // Token: 0x04007662 RID: 30306 [FieldOffset(Offset = "0x48")] [Token(Token = "0x4007662")] private ICipherParameters pubParam; // Token: 0x04007663 RID: 30307 [FieldOffset(Offset = "0x50")] [Token(Token = "0x4007663")] private IesParameters param; } }