using System; using BestHTTP.SecureProtocol.Org.BouncyCastle.Security; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings { // Token: 0x02001CBE RID: 7358 [Token(Token = "0x2001CBE")] public class Pkcs1Encoding : IAsymmetricBlockCipher { // Token: 0x17001D05 RID: 7429 // (get) Token: 0x0600B981 RID: 47489 RVA: 0x0029AF18 File Offset: 0x00299118 // (set) Token: 0x0600B982 RID: 47490 RVA: 0x0029AF40 File Offset: 0x00299140 [Token(Token = "0x17001D05")] public static bool StrictLengthEnabled { [Token(Token = "0x600B981")] [Address(RVA = "0x1A76370", Offset = "0x1A75170", VA = "0x181A76370")] get { bool[] array = Pkcs1Encoding.strictLengthEnabled; return "{il2cpp array field local0->}" != (ulong)0L; } [Token(Token = "0x600B982")] [Address(RVA = "0x1A763F0", Offset = "0x1A751F0", VA = "0x181A763F0")] set { Pkcs1Encoding.strictLengthEnabled[0] = value; } } // Token: 0x0600B983 RID: 47491 RVA: 0x0029AF60 File Offset: 0x00299160 [Token(Token = "0x600B983")] [Address(RVA = "0x1A76090", Offset = "0x1A74E90", VA = "0x181A76090")] static Pkcs1Encoding() { string environmentVariable = Platform.GetEnvironmentVariable("BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs1.Strict"); bool[] array = new bool[1]; if (environmentVariable == 0) { } bool flag = environmentVariable.Equals("true"); array[0] = flag; Pkcs1Encoding.strictLengthEnabled = array; } // Token: 0x0600B984 RID: 47492 RVA: 0x0029AFA4 File Offset: 0x002991A4 [Token(Token = "0x600B984")] [Address(RVA = "0x1A76290", Offset = "0x1A75090", VA = "0x181A76290")] public Pkcs1Encoding(IAsymmetricBlockCipher cipher) { this.engine = cipher; bool flag = Pkcs1Encoding.StrictLengthEnabled; this.useStrictLength = flag; } // Token: 0x0600B985 RID: 47493 RVA: 0x0029AFE0 File Offset: 0x002991E0 [Token(Token = "0x600B985")] [Address(RVA = "0x1A76160", Offset = "0x1A74F60", VA = "0x181A76160")] public Pkcs1Encoding(IAsymmetricBlockCipher cipher, int pLen) { this.engine = cipher; bool flag = Pkcs1Encoding.StrictLengthEnabled; this.pLen = pLen; this.useStrictLength = flag; } // Token: 0x0600B986 RID: 47494 RVA: 0x0029B020 File Offset: 0x00299220 [Token(Token = "0x600B986")] [Address(RVA = "0x1A761F0", Offset = "0x1A74FF0", VA = "0x181A761F0")] public Pkcs1Encoding(IAsymmetricBlockCipher cipher, byte[] fallback) { this.engine = cipher; bool flag = Pkcs1Encoding.StrictLengthEnabled; this.useStrictLength = flag; this.fallback = fallback; int length = fallback.Length; this.pLen = length; } // Token: 0x0600B987 RID: 47495 RVA: 0x0029B074 File Offset: 0x00299274 [Token(Token = "0x600B987")] [Address(RVA = "0x3F5F40", Offset = "0x3F4D40", VA = "0x1803F5F40")] public IAsymmetricBlockCipher GetUnderlyingCipher() { return this.engine; } // Token: 0x17001D06 RID: 7430 // (get) Token: 0x0600B988 RID: 47496 RVA: 0x0029B088 File Offset: 0x00299288 [Token(Token = "0x17001D06")] public string AlgorithmName { [Token(Token = "0x600B988")] [Address(RVA = "0x1A76310", Offset = "0x1A75110", VA = "0x181A76310", Slot = "4")] get { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; return 0 + "/PKCS1Padding"; } } // Token: 0x0600B989 RID: 47497 RVA: 0x0029B0B0 File Offset: 0x002992B0 [Token(Token = "0x600B989")] [Address(RVA = "0x1A75DF0", Offset = "0x1A74BF0", VA = "0x181A75DF0", Slot = "5")] public void Init(bool forEncryption, ICipherParameters parameters) { /* An exception occurred when decompiling this method (0600B989) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings.Pkcs1Encoding::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_84: stloc:ArgumentException(var_8_8E, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("encoder requires random"))) } 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: 0x0600B98A RID: 47498 RVA: 0x0029B14C File Offset: 0x0029934C [Token(Token = "0x600B98A")] [Address(RVA = "0x1A75D30", Offset = "0x1A74B30", VA = "0x181A75D30", Slot = "6")] public int GetInputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (this.forEncryption) { } throw new NullReferenceException(); } // Token: 0x0600B98B RID: 47499 RVA: 0x0029B170 File Offset: 0x00299370 [Token(Token = "0x600B98B")] [Address(RVA = "0x1A75D90", Offset = "0x1A74B90", VA = "0x181A75D90", Slot = "7")] public int GetOutputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (!this.forEncryption) { } throw new NullReferenceException(); } // Token: 0x0600B98C RID: 47500 RVA: 0x0029B194 File Offset: 0x00299394 [Token(Token = "0x600B98C")] [Address(RVA = "0x1A76060", Offset = "0x1A74E60", VA = "0x181A76060", Slot = "8")] public byte[] ProcessBlock(byte[] input, int inOff, int length) { if (this.forEncryption) { return this.EncodeBlock(input, inOff, length); } return this.DecodeBlock(input, inOff, length); } // Token: 0x0600B98D RID: 47501 RVA: 0x0029B1C0 File Offset: 0x002993C0 [Token(Token = "0x600B98D")] [Address(RVA = "0x1A759B0", Offset = "0x1A747B0", VA = "0x181A759B0")] private byte[] EncodeBlock(byte[] input, int inOff, int inLen) { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (this.forEncryption) { } IAsymmetricBlockCipher asymmetricBlockCipher2 = this.engine; byte[] array = new byte[0]; if (!this.forPrivateKey) { double num = this.random.NextDouble(); array[0] = (byte)((ulong)2L); int num2 = array.Length; num2 -= inLen; uint num3; if (num3 == (uint)num2) { goto IL_83; } int length = array.Length; SecureRandom secureRandom = this.random; num3 += (uint)1; } int num4 = array.Length; num4 -= inLen; uint num5; if (num5 != (uint)num4) { num5 += (uint)1; } IL_83: num4 -= inLen; int num6 = num4 - 1; int num7 = array.Length; num7 -= inLen; num4 = inOff; Array.Copy(input, num4, array, num7, inLen); IAsymmetricBlockCipher asymmetricBlockCipher3 = this.engine; int length2 = array.Length; throw new NullReferenceException(); } // Token: 0x0600B98E RID: 47502 RVA: 0x0029B294 File Offset: 0x00299494 [Token(Token = "0x600B98E")] [Address(RVA = "0x1A752A0", Offset = "0x1A740A0", VA = "0x181A752A0")] private static int CheckPkcs1Encoding(byte[] encoded, int pLen) { int num = encoded.Length; num -= pLen; uint num2; if (num - 1 > (int)num2) { num2 += (uint)1; } int num3 = num - 1; throw new NullReferenceException(); } // Token: 0x0600B98F RID: 47503 RVA: 0x0029B2C0 File Offset: 0x002994C0 [Token(Token = "0x600B98F")] [Address(RVA = "0x1A75390", Offset = "0x1A74190", VA = "0x181A75390")] private byte[] DecodeBlockOrRandom(byte[] input, int inOff, int inLen) { /* An exception occurred when decompiling this method (0600B98F) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings.Pkcs1Encoding::DecodeBlockOrRandom(System.Byte[],System.Int32,System.Int32) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_C7: stloc:InvalidCipherTextException(var_18_D1, newobj:InvalidCipherTextException(InvalidCipherTextException::.ctor, ldstr:string("sorry, this method is only for decryption, not for signing"))) } 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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846 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: 0x0600B990 RID: 47504 RVA: 0x0029B3A0 File Offset: 0x002995A0 [Token(Token = "0x600B990")] [Address(RVA = "0x1A756A0", Offset = "0x1A744A0", VA = "0x181A756A0")] private byte[] DecodeBlock(byte[] input, int inOff, int inLen) { /* An exception occurred when decompiling this method (0600B990) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings.Pkcs1Encoding::DecodeBlock(System.Byte[],System.Int32,System.Int32) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_C5: stloc:InvalidCipherTextException(var_20_CF, newobj:InvalidCipherTextException(InvalidCipherTextException::.ctor, ldstr:string("block incorrect size"))) } 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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878 at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846 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: 0x0600B991 RID: 47505 RVA: 0x0029B480 File Offset: 0x00299680 [Token(Token = "0x600B991")] [Address(RVA = "0x1A75C80", Offset = "0x1A74A80", VA = "0x181A75C80")] private int FindStart(byte type, byte[] block) { int length = block.Length; if ((uint)1 != (uint)length) { } return -1; } // Token: 0x04007610 RID: 30224 [Token(Token = "0x4007610")] public const string StrictLengthEnabledProperty = "BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs1.Strict"; // Token: 0x04007611 RID: 30225 [Token(Token = "0x4007611")] private const int HeaderLength = 10; // Token: 0x04007612 RID: 30226 [Token(Token = "0x4007612")] private static readonly bool[] strictLengthEnabled; // Token: 0x04007613 RID: 30227 [FieldOffset(Offset = "0x10")] [Token(Token = "0x4007613")] private SecureRandom random; // Token: 0x04007614 RID: 30228 [FieldOffset(Offset = "0x18")] [Token(Token = "0x4007614")] private IAsymmetricBlockCipher engine; // Token: 0x04007615 RID: 30229 [FieldOffset(Offset = "0x20")] [Token(Token = "0x4007615")] private bool forEncryption; // Token: 0x04007616 RID: 30230 [FieldOffset(Offset = "0x21")] [Token(Token = "0x4007616")] private bool forPrivateKey; // Token: 0x04007617 RID: 30231 [FieldOffset(Offset = "0x22")] [Token(Token = "0x4007617")] private bool useStrictLength; // Token: 0x04007618 RID: 30232 [FieldOffset(Offset = "0x24")] [Token(Token = "0x4007618")] private int pLen = (int)((ulong)4294967295L); // Token: 0x04007619 RID: 30233 [FieldOffset(Offset = "0x28")] [Token(Token = "0x4007619")] private byte[] fallback; // Token: 0x0400761A RID: 30234 [FieldOffset(Offset = "0x30")] [Token(Token = "0x400761A")] private byte[] blockBuffer; } }