using System; using BestHTTP.SecureProtocol.Org.BouncyCastle.Security; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings { // Token: 0x02001D9E RID: 7582 [Token(Token = "0x2001D9E")] public class Pkcs1Encoding : IAsymmetricBlockCipher { // Token: 0x17001DA2 RID: 7586 // (get) Token: 0x0600BD4F RID: 48463 RVA: 0x002A38C0 File Offset: 0x002A1AC0 // (set) Token: 0x0600BD50 RID: 48464 RVA: 0x002A38E8 File Offset: 0x002A1AE8 [Token(Token = "0x17001DA2")] public static bool StrictLengthEnabled { [Token(Token = "0x600BD4F")] [Address(RVA = "0x24A1900", Offset = "0x24A0900", VA = "0x1824A1900")] get { bool[] array = Pkcs1Encoding.strictLengthEnabled; return "{il2cpp array field local0->}" != (ulong)0L; } [Token(Token = "0x600BD50")] [Address(RVA = "0x24A1980", Offset = "0x24A0980", VA = "0x1824A1980")] set { Pkcs1Encoding.strictLengthEnabled[0] = value; } } // Token: 0x0600BD51 RID: 48465 RVA: 0x002A3908 File Offset: 0x002A1B08 [Token(Token = "0x600BD51")] [Address(RVA = "0x24A1620", Offset = "0x24A0620", VA = "0x1824A1620")] 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: 0x0600BD52 RID: 48466 RVA: 0x002A394C File Offset: 0x002A1B4C [Token(Token = "0x600BD52")] [Address(RVA = "0x24A1820", Offset = "0x24A0820", VA = "0x1824A1820")] public Pkcs1Encoding(IAsymmetricBlockCipher cipher) { this.engine = cipher; bool flag = Pkcs1Encoding.StrictLengthEnabled; this.useStrictLength = flag; } // Token: 0x0600BD53 RID: 48467 RVA: 0x002A3988 File Offset: 0x002A1B88 [Token(Token = "0x600BD53")] [Address(RVA = "0x24A16F0", Offset = "0x24A06F0", VA = "0x1824A16F0")] public Pkcs1Encoding(IAsymmetricBlockCipher cipher, int pLen) { this.engine = cipher; bool flag = Pkcs1Encoding.StrictLengthEnabled; this.pLen = pLen; this.useStrictLength = flag; } // Token: 0x0600BD54 RID: 48468 RVA: 0x002A39C8 File Offset: 0x002A1BC8 [Token(Token = "0x600BD54")] [Address(RVA = "0x24A1780", Offset = "0x24A0780", VA = "0x1824A1780")] 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: 0x0600BD55 RID: 48469 RVA: 0x002A3A1C File Offset: 0x002A1C1C [Token(Token = "0x600BD55")] [Address(RVA = "0x4157B0", Offset = "0x4147B0", VA = "0x1804157B0")] public IAsymmetricBlockCipher GetUnderlyingCipher() { return this.engine; } // Token: 0x17001DA3 RID: 7587 // (get) Token: 0x0600BD56 RID: 48470 RVA: 0x002A3A30 File Offset: 0x002A1C30 [Token(Token = "0x17001DA3")] public string AlgorithmName { [Token(Token = "0x600BD56")] [Address(RVA = "0x24A18A0", Offset = "0x24A08A0", VA = "0x1824A18A0", Slot = "4")] get { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; return 0 + "/PKCS1Padding"; } } // Token: 0x0600BD57 RID: 48471 RVA: 0x002A3A58 File Offset: 0x002A1C58 [Token(Token = "0x600BD57")] [Address(RVA = "0x24A1380", Offset = "0x24A0380", VA = "0x1824A1380", Slot = "5")] public void Init(bool forEncryption, ICipherParameters parameters) { /* An exception occurred when decompiling this method (0600BD57) 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: 0x0600BD58 RID: 48472 RVA: 0x002A3AF4 File Offset: 0x002A1CF4 [Token(Token = "0x600BD58")] [Address(RVA = "0x24A12C0", Offset = "0x24A02C0", VA = "0x1824A12C0", Slot = "6")] public int GetInputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (this.forEncryption) { } throw new NullReferenceException(); } // Token: 0x0600BD59 RID: 48473 RVA: 0x002A3B18 File Offset: 0x002A1D18 [Token(Token = "0x600BD59")] [Address(RVA = "0x24A1320", Offset = "0x24A0320", VA = "0x1824A1320", Slot = "7")] public int GetOutputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (!this.forEncryption) { } throw new NullReferenceException(); } // Token: 0x0600BD5A RID: 48474 RVA: 0x002A3B3C File Offset: 0x002A1D3C [Token(Token = "0x600BD5A")] [Address(RVA = "0x24A15F0", Offset = "0x24A05F0", VA = "0x1824A15F0", 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: 0x0600BD5B RID: 48475 RVA: 0x002A3B68 File Offset: 0x002A1D68 [Token(Token = "0x600BD5B")] [Address(RVA = "0x24A0F40", Offset = "0x249FF40", VA = "0x1824A0F40")] 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: 0x0600BD5C RID: 48476 RVA: 0x002A3C3C File Offset: 0x002A1E3C [Token(Token = "0x600BD5C")] [Address(RVA = "0x24A0830", Offset = "0x249F830", VA = "0x1824A0830")] 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: 0x0600BD5D RID: 48477 RVA: 0x002A3C68 File Offset: 0x002A1E68 [Token(Token = "0x600BD5D")] [Address(RVA = "0x24A0920", Offset = "0x249F920", VA = "0x1824A0920")] private byte[] DecodeBlockOrRandom(byte[] input, int inOff, int inLen) { /* An exception occurred when decompiling this method (0600BD5D) 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: 0x0600BD5E RID: 48478 RVA: 0x002A3D48 File Offset: 0x002A1F48 [Token(Token = "0x600BD5E")] [Address(RVA = "0x24A0C30", Offset = "0x249FC30", VA = "0x1824A0C30")] private byte[] DecodeBlock(byte[] input, int inOff, int inLen) { /* An exception occurred when decompiling this method (0600BD5E) 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: 0x0600BD5F RID: 48479 RVA: 0x002A3E28 File Offset: 0x002A2028 [Token(Token = "0x600BD5F")] [Address(RVA = "0x24A1210", Offset = "0x24A0210", VA = "0x1824A1210")] private int FindStart(byte type, byte[] block) { int length = block.Length; if ((uint)1 != (uint)length) { } return -1; } // Token: 0x040077C9 RID: 30665 [Token(Token = "0x40077C9")] public const string StrictLengthEnabledProperty = "BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs1.Strict"; // Token: 0x040077CA RID: 30666 [Token(Token = "0x40077CA")] private const int HeaderLength = 10; // Token: 0x040077CB RID: 30667 [Token(Token = "0x40077CB")] private static readonly bool[] strictLengthEnabled; // Token: 0x040077CC RID: 30668 [FieldOffset(Offset = "0x10")] [Token(Token = "0x40077CC")] private SecureRandom random; // Token: 0x040077CD RID: 30669 [FieldOffset(Offset = "0x18")] [Token(Token = "0x40077CD")] private IAsymmetricBlockCipher engine; // Token: 0x040077CE RID: 30670 [FieldOffset(Offset = "0x20")] [Token(Token = "0x40077CE")] private bool forEncryption; // Token: 0x040077CF RID: 30671 [FieldOffset(Offset = "0x21")] [Token(Token = "0x40077CF")] private bool forPrivateKey; // Token: 0x040077D0 RID: 30672 [FieldOffset(Offset = "0x22")] [Token(Token = "0x40077D0")] private bool useStrictLength; // Token: 0x040077D1 RID: 30673 [FieldOffset(Offset = "0x24")] [Token(Token = "0x40077D1")] private int pLen = (int)((ulong)4294967295L); // Token: 0x040077D2 RID: 30674 [FieldOffset(Offset = "0x28")] [Token(Token = "0x40077D2")] private byte[] fallback; // Token: 0x040077D3 RID: 30675 [FieldOffset(Offset = "0x30")] [Token(Token = "0x40077D3")] private byte[] blockBuffer; } }