using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using BestHTTP.SecureProtocol.Org.BouncyCastle.Math; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings { // Token: 0x020016DF RID: 5855 [Token(Token = "0x20016DF")] [StructLayout(3)] public class ISO9796d1Encoding : IAsymmetricBlockCipher { // Token: 0x06009D8D RID: 40333 RVA: 0x00242330 File Offset: 0x00240530 [Token(Token = "0x6009D8D")] [Address(RVA = "0x3C3A30", Offset = "0x3C2430", VA = "0x1803C3A30")] public ISO9796d1Encoding(IAsymmetricBlockCipher cipher) { this.engine = cipher; } // Token: 0x17001902 RID: 6402 // (get) Token: 0x06009D8E RID: 40334 RVA: 0x0024234C File Offset: 0x0024054C [Token(Token = "0x17001902")] public string AlgorithmName { [Token(Token = "0x6009D8E")] [Address(RVA = "0x205BF90", Offset = "0x205A990", VA = "0x18205BF90", Slot = "4")] get { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; return 0 + "/ISO9796-1Padding"; } } // Token: 0x06009D8F RID: 40335 RVA: 0x00242374 File Offset: 0x00240574 [Token(Token = "0x6009D8F")] [Address(RVA = "0x3C39A0", Offset = "0x3C23A0", VA = "0x1803C39A0")] public IAsymmetricBlockCipher GetUnderlyingCipher() { return this.engine; } // Token: 0x06009D90 RID: 40336 RVA: 0x00242388 File Offset: 0x00240588 [Token(Token = "0x6009D90")] [Address(RVA = "0x205BC10", Offset = "0x205A610", VA = "0x18205BC10", Slot = "5")] public void Init(bool forEncryption, ICipherParameters parameters) { while (parameters != 0) { if ((parameters != 0 || parameters != 0) && parameters != 0 && parameters != 0) { if (parameters == 0) { IL_2A: IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; this.modulus = (uint)1; this.forEncryption = forEncryption; int num; this.bitSize = num; return; } if (parameters != 0) { break; } } } goto IL_2A; } // Token: 0x06009D91 RID: 40337 RVA: 0x002423E4 File Offset: 0x002405E4 [Token(Token = "0x6009D91")] [Address(RVA = "0x205BB50", Offset = "0x205A550", VA = "0x18205BB50", Slot = "6")] public int GetInputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (this.inverse != (ulong)0L) { } throw new NullReferenceException(); } // Token: 0x06009D92 RID: 40338 RVA: 0x00242408 File Offset: 0x00240608 [Token(Token = "0x6009D92")] [Address(RVA = "0x205BBB0", Offset = "0x205A5B0", VA = "0x18205BBB0", Slot = "7")] public int GetOutputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (this.inverse == (ulong)0L) { } throw new NullReferenceException(); } // Token: 0x06009D93 RID: 40339 RVA: 0x0024242C File Offset: 0x0024062C [Token(Token = "0x6009D93")] [Address(RVA = "0x205BE30", Offset = "0x205A830", VA = "0x18205BE30")] public void SetPadBits(int padBits) { this.padBits = padBits; } // Token: 0x06009D94 RID: 40340 RVA: 0x0024244C File Offset: 0x0024064C [Token(Token = "0x6009D94")] [Address(RVA = "0x4FBD40", Offset = "0x4FA740", VA = "0x1804FBD40")] public int GetPadBits() { return this.padBits; } // Token: 0x06009D95 RID: 40341 RVA: 0x00242460 File Offset: 0x00240660 [Token(Token = "0x6009D95")] [Address(RVA = "0x205BE00", Offset = "0x205A800", VA = "0x18205BE00", Slot = "8")] public byte[] ProcessBlock(byte[] input, int inOff, int length) { if (this.inverse == (ulong)0L) { return this.DecodeBlock(input, inOff, length); } return this.EncodeBlock(input, inOff, length); } // Token: 0x06009D96 RID: 40342 RVA: 0x0024248C File Offset: 0x0024068C [Token(Token = "0x6009D96")] [Address(RVA = "0x205B7C0", Offset = "0x205A1C0", VA = "0x18205B7C0")] private byte[] EncodeBlock(byte[] input, int inOff, int inLen) { int num = this.bitSize; num += 7; byte[] array = new byte[input]; int num2 = this.padBits; int num3 = this.bitSize; num2++; num3 += 13; int num4 = 0; num3 += input; if (num3 > 0) { num3 -= inLen; int num5 = array.Length; num5 -= num4; num5 -= inLen; int num6 = array.Length; num6 -= inLen; num4 += inLen; num3 = inLen - inLen; } int num7 = array.Length; num7 -= num3; int length = array.Length; int num8; if (num7 != length) { num3 = num7; num3 -= 0; num3 -= num3; num8 = ISO9796d1Encoding.shadows.Length; num8 = num7; num8++; num7 += 2; } byte b; num8 -= (int)b; int length2 = array.Length; if (length2 - 1 < length2) { } uint num9; byte b2; num9 -= (uint)b2; int length3 = array.Length; if (num9 == (uint)8) { array[0] = (byte)((ulong)0L); } uint num10; array[0] = (byte)num10; uint num11; array[0] = (byte)num11; int num12 = 0; int num13 = array.Length; num13 -= num12; throw new NullReferenceException(); } // Token: 0x06009D97 RID: 40343 RVA: 0x002425A4 File Offset: 0x002407A4 [Token(Token = "0x6009D97")] [Address(RVA = "0x205B1C0", Offset = "0x2059BC0", VA = "0x18205B1C0")] private byte[] DecodeBlock(byte[] input, int inOff, int inLen) { /* An exception occurred when decompiling this method (06009D97) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings.ISO9796d1Encoding::DecodeBlock(System.Byte[],System.Int32,System.Int32) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_140: stloc:InvalidCipherTextException(var_33_14A, newobj:InvalidCipherTextException(InvalidCipherTextException::.ctor, ldstr:string("resulting integer iS or (modulus - iS) is not congruent to 6 mod 16"))) } 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: 0x06009D98 RID: 40344 RVA: 0x002426FC File Offset: 0x002408FC // Note: this type is marked as 'beforefieldinit'. [Token(Token = "0x6009D98")] [Address(RVA = "0x205BEA0", Offset = "0x205A8A0", VA = "0x18205BEA0")] static ISO9796d1Encoding() { BigInteger bigInteger; ISO9796d1Encoding.Sixteen = bigInteger; BigInteger bigInteger2; ISO9796d1Encoding.Six = bigInteger2; byte[] array = new byte[16]; RuntimeHelpers.InitializeArray(array, fieldof(.27C3AB82CCA6CE2F199F4F670BF19513A3825B87).FieldHandle); ISO9796d1Encoding.shadows = array; byte[] array2 = new byte[16]; RuntimeHelpers.InitializeArray(array2, fieldof(.30F65A149AF7DE938A9287048498B966AEBE54D4).FieldHandle); ISO9796d1Encoding.inverse = array2; } // Token: 0x040067BF RID: 26559 [Token(Token = "0x40067BF")] private static readonly BigInteger Sixteen; // Token: 0x040067C0 RID: 26560 [Token(Token = "0x40067C0")] private static readonly BigInteger Six; // Token: 0x040067C1 RID: 26561 [Token(Token = "0x40067C1")] private static readonly byte[] shadows; // Token: 0x040067C2 RID: 26562 [Token(Token = "0x40067C2")] private static readonly byte[] inverse; // Token: 0x040067C3 RID: 26563 [global::Cpp2IlInjected.FieldOffset(Offset = "0x10")] [Token(Token = "0x40067C3")] private readonly IAsymmetricBlockCipher engine; // Token: 0x040067C4 RID: 26564 [global::Cpp2IlInjected.FieldOffset(Offset = "0x18")] [Token(Token = "0x40067C4")] private bool forEncryption; // Token: 0x040067C5 RID: 26565 [global::Cpp2IlInjected.FieldOffset(Offset = "0x1C")] [Token(Token = "0x40067C5")] private int bitSize; // Token: 0x040067C6 RID: 26566 [global::Cpp2IlInjected.FieldOffset(Offset = "0x20")] [Token(Token = "0x40067C6")] private int padBits; // Token: 0x040067C7 RID: 26567 [global::Cpp2IlInjected.FieldOffset(Offset = "0x28")] [Token(Token = "0x40067C7")] private BigInteger modulus; } }