using System; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines { // Token: 0x02001C97 RID: 7319 [Token(Token = "0x2001C97")] public class IesEngine { // Token: 0x0600B7E4 RID: 47076 RVA: 0x0028C8F4 File Offset: 0x0028AAF4 [Token(Token = "0x600B7E4")] [Address(RVA = "0x1DD2870", Offset = "0x1DD1670", VA = "0x181DD2870")] 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: 0x0600B7E5 RID: 47077 RVA: 0x0028C930 File Offset: 0x0028AB30 [Token(Token = "0x600B7E5")] [Address(RVA = "0x1DD27D0", Offset = "0x1DD15D0", VA = "0x181DD27D0")] 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: 0x0600B7E6 RID: 47078 RVA: 0x0028C974 File Offset: 0x0028AB74 [Token(Token = "0x600B7E6")] [Address(RVA = "0x1DD2520", Offset = "0x1DD1320", VA = "0x181DD2520", 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: 0x0600B7E7 RID: 47079 RVA: 0x0028C9A0 File Offset: 0x0028ABA0 [Token(Token = "0x600B7E7")] [Address(RVA = "0x1DD1A80", Offset = "0x1DD0880", VA = "0x181DD1A80")] private byte[] DecryptBlock(byte[] in_enc, int inOff, int inLen, byte[] z) { /* An exception occurred when decompiling this method (0600B7E7) 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 1660 */; } // Token: 0x0600B7E8 RID: 47080 RVA: 0x0028CAE8 File Offset: 0x0028ACE8 [Token(Token = "0x600B7E8")] [Address(RVA = "0x1DD1F70", Offset = "0x1DD0D70", VA = "0x181DD1F70")] 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: 0x0600B7E9 RID: 47081 RVA: 0x0028CC08 File Offset: 0x0028AE08 [Token(Token = "0x600B7E9")] [Address(RVA = "0x1DD2410", Offset = "0x1DD1210", VA = "0x181DD2410")] 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: 0x0600B7EA RID: 47082 RVA: 0x0028CC4C File Offset: 0x0028AE4C [Token(Token = "0x600B7EA")] [Address(RVA = "0x1DD25E0", Offset = "0x1DD13E0", VA = "0x181DD25E0", 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: 0x040074A2 RID: 29858 [FieldOffset(Offset = "0x10")] [Token(Token = "0x40074A2")] private readonly IBasicAgreement agree; // Token: 0x040074A3 RID: 29859 [FieldOffset(Offset = "0x18")] [Token(Token = "0x40074A3")] private readonly IDerivationFunction kdf; // Token: 0x040074A4 RID: 29860 [FieldOffset(Offset = "0x20")] [Token(Token = "0x40074A4")] private readonly IMac mac; // Token: 0x040074A5 RID: 29861 [FieldOffset(Offset = "0x28")] [Token(Token = "0x40074A5")] private readonly BufferedBlockCipher cipher; // Token: 0x040074A6 RID: 29862 [FieldOffset(Offset = "0x30")] [Token(Token = "0x40074A6")] private readonly byte[] macBuf; // Token: 0x040074A7 RID: 29863 [FieldOffset(Offset = "0x38")] [Token(Token = "0x40074A7")] private bool forEncryption; // Token: 0x040074A8 RID: 29864 [FieldOffset(Offset = "0x40")] [Token(Token = "0x40074A8")] private ICipherParameters privParam; // Token: 0x040074A9 RID: 29865 [FieldOffset(Offset = "0x48")] [Token(Token = "0x40074A9")] private ICipherParameters pubParam; // Token: 0x040074AA RID: 29866 [FieldOffset(Offset = "0x50")] [Token(Token = "0x40074AA")] private IesParameters param; } }