using System; using System.Runtime.CompilerServices; using BestHTTP.SecureProtocol.Org.BouncyCastle.Math; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings { // Token: 0x02001CBC RID: 7356 [Token(Token = "0x2001CBC")] public class ISO9796d1Encoding : IAsymmetricBlockCipher { // Token: 0x0600B967 RID: 47463 RVA: 0x0029A444 File Offset: 0x00298644 [Token(Token = "0x600B967")] [Address(RVA = "0x3FFB80", Offset = "0x3FE980", VA = "0x1803FFB80")] public ISO9796d1Encoding(IAsymmetricBlockCipher cipher) { this.engine = cipher; } // Token: 0x17001D03 RID: 7427 // (get) Token: 0x0600B968 RID: 47464 RVA: 0x0029A460 File Offset: 0x00298660 [Token(Token = "0x17001D03")] public string AlgorithmName { [Token(Token = "0x600B968")] [Address(RVA = "0x1A740B0", Offset = "0x1A72EB0", VA = "0x181A740B0", Slot = "4")] get { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; return 0 + "/ISO9796-1Padding"; } } // Token: 0x0600B969 RID: 47465 RVA: 0x0029A488 File Offset: 0x00298688 [Token(Token = "0x600B969")] [Address(RVA = "0x3F6E20", Offset = "0x3F5C20", VA = "0x1803F6E20")] public IAsymmetricBlockCipher GetUnderlyingCipher() { return this.engine; } // Token: 0x0600B96A RID: 47466 RVA: 0x0029A49C File Offset: 0x0029869C [Token(Token = "0x600B96A")] [Address(RVA = "0x1A73D30", Offset = "0x1A72B30", VA = "0x181A73D30", 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: 0x0600B96B RID: 47467 RVA: 0x0029A4F8 File Offset: 0x002986F8 [Token(Token = "0x600B96B")] [Address(RVA = "0x1A73C70", Offset = "0x1A72A70", VA = "0x181A73C70", Slot = "6")] public int GetInputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (this.inverse != (ulong)0L) { } throw new NullReferenceException(); } // Token: 0x0600B96C RID: 47468 RVA: 0x0029A51C File Offset: 0x0029871C [Token(Token = "0x600B96C")] [Address(RVA = "0x1A73CD0", Offset = "0x1A72AD0", VA = "0x181A73CD0", Slot = "7")] public int GetOutputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (this.inverse == (ulong)0L) { } throw new NullReferenceException(); } // Token: 0x0600B96D RID: 47469 RVA: 0x0029A540 File Offset: 0x00298740 [Token(Token = "0x600B96D")] [Address(RVA = "0x1A73F50", Offset = "0x1A72D50", VA = "0x181A73F50")] public void SetPadBits(int padBits) { this.padBits = padBits; } // Token: 0x0600B96E RID: 47470 RVA: 0x0029A560 File Offset: 0x00298760 [Token(Token = "0x600B96E")] [Address(RVA = "0x3F7310", Offset = "0x3F6110", VA = "0x1803F7310")] public int GetPadBits() { return this.padBits; } // Token: 0x0600B96F RID: 47471 RVA: 0x0029A574 File Offset: 0x00298774 [Token(Token = "0x600B96F")] [Address(RVA = "0x1A73F20", Offset = "0x1A72D20", VA = "0x181A73F20", 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: 0x0600B970 RID: 47472 RVA: 0x0029A5A0 File Offset: 0x002987A0 [Token(Token = "0x600B970")] [Address(RVA = "0x1A738E0", Offset = "0x1A726E0", VA = "0x181A738E0")] 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: 0x0600B971 RID: 47473 RVA: 0x0029A6B8 File Offset: 0x002988B8 [Token(Token = "0x600B971")] [Address(RVA = "0x1A732E0", Offset = "0x1A720E0", VA = "0x181A732E0")] private byte[] DecodeBlock(byte[] input, int inOff, int inLen) { /* An exception occurred when decompiling this method (0600B971) 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: 0x0600B972 RID: 47474 RVA: 0x0029A810 File Offset: 0x00298A10 // Note: this type is marked as 'beforefieldinit'. [Token(Token = "0x600B972")] [Address(RVA = "0x1A73FC0", Offset = "0x1A72DC0", VA = "0x181A73FC0")] 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: 0x04007602 RID: 30210 [Token(Token = "0x4007602")] private static readonly BigInteger Sixteen; // Token: 0x04007603 RID: 30211 [Token(Token = "0x4007603")] private static readonly BigInteger Six; // Token: 0x04007604 RID: 30212 [Token(Token = "0x4007604")] private static readonly byte[] shadows; // Token: 0x04007605 RID: 30213 [Token(Token = "0x4007605")] private static readonly byte[] inverse; // Token: 0x04007606 RID: 30214 [FieldOffset(Offset = "0x10")] [Token(Token = "0x4007606")] private readonly IAsymmetricBlockCipher engine; // Token: 0x04007607 RID: 30215 [FieldOffset(Offset = "0x18")] [Token(Token = "0x4007607")] private bool forEncryption; // Token: 0x04007608 RID: 30216 [FieldOffset(Offset = "0x1C")] [Token(Token = "0x4007608")] private int bitSize; // Token: 0x04007609 RID: 30217 [FieldOffset(Offset = "0x20")] [Token(Token = "0x4007609")] private int padBits; // Token: 0x0400760A RID: 30218 [FieldOffset(Offset = "0x28")] [Token(Token = "0x400760A")] private BigInteger modulus; } }