using System; using System.Runtime.InteropServices; using BestHTTP.SecureProtocol.Org.BouncyCastle.Security; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings { // Token: 0x020016E1 RID: 5857 [Token(Token = "0x20016E1")] [StructLayout(3)] public class Pkcs1Encoding : IAsymmetricBlockCipher { // Token: 0x17001904 RID: 6404 // (get) Token: 0x06009DA7 RID: 40359 RVA: 0x00242E04 File Offset: 0x00241004 // (set) Token: 0x06009DA8 RID: 40360 RVA: 0x00242E2C File Offset: 0x0024102C [Token(Token = "0x17001904")] public static bool StrictLengthEnabled { [Token(Token = "0x6009DA7")] [Address(RVA = "0x205E250", Offset = "0x205CC50", VA = "0x18205E250")] get { bool[] array = Pkcs1Encoding.strictLengthEnabled; return "{il2cpp array field local0->}" != (ulong)0L; } [Token(Token = "0x6009DA8")] [Address(RVA = "0x205E2D0", Offset = "0x205CCD0", VA = "0x18205E2D0")] set { Pkcs1Encoding.strictLengthEnabled[0] = value; } } // Token: 0x06009DA9 RID: 40361 RVA: 0x00242E4C File Offset: 0x0024104C [Token(Token = "0x6009DA9")] [Address(RVA = "0x205DF70", Offset = "0x205C970", VA = "0x18205DF70")] 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: 0x06009DAA RID: 40362 RVA: 0x00242E90 File Offset: 0x00241090 [Token(Token = "0x6009DAA")] [Address(RVA = "0x205E170", Offset = "0x205CB70", VA = "0x18205E170")] public Pkcs1Encoding(IAsymmetricBlockCipher cipher) { this.engine = cipher; bool flag = Pkcs1Encoding.StrictLengthEnabled; this.useStrictLength = flag; } // Token: 0x06009DAB RID: 40363 RVA: 0x00242ECC File Offset: 0x002410CC [Token(Token = "0x6009DAB")] [Address(RVA = "0x205E040", Offset = "0x205CA40", VA = "0x18205E040")] public Pkcs1Encoding(IAsymmetricBlockCipher cipher, int pLen) { this.engine = cipher; bool flag = Pkcs1Encoding.StrictLengthEnabled; this.pLen = pLen; this.useStrictLength = flag; } // Token: 0x06009DAC RID: 40364 RVA: 0x00242F0C File Offset: 0x0024110C [Token(Token = "0x6009DAC")] [Address(RVA = "0x205E0D0", Offset = "0x205CAD0", VA = "0x18205E0D0")] 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: 0x06009DAD RID: 40365 RVA: 0x00242F60 File Offset: 0x00241160 [Token(Token = "0x6009DAD")] [Address(RVA = "0x3C1240", Offset = "0x3BFC40", VA = "0x1803C1240")] public IAsymmetricBlockCipher GetUnderlyingCipher() { return this.engine; } // Token: 0x17001905 RID: 6405 // (get) Token: 0x06009DAE RID: 40366 RVA: 0x00242F74 File Offset: 0x00241174 [Token(Token = "0x17001905")] public string AlgorithmName { [Token(Token = "0x6009DAE")] [Address(RVA = "0x205E1F0", Offset = "0x205CBF0", VA = "0x18205E1F0", Slot = "4")] get { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; return 0 + "/PKCS1Padding"; } } // Token: 0x06009DAF RID: 40367 RVA: 0x00242F9C File Offset: 0x0024119C [Token(Token = "0x6009DAF")] [Address(RVA = "0x205DCD0", Offset = "0x205C6D0", VA = "0x18205DCD0", Slot = "5")] public void Init(bool forEncryption, ICipherParameters parameters) { /* An exception occurred when decompiling this method (06009DAF) 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: 0x06009DB0 RID: 40368 RVA: 0x00243038 File Offset: 0x00241238 [Token(Token = "0x6009DB0")] [Address(RVA = "0x205DC10", Offset = "0x205C610", VA = "0x18205DC10", Slot = "6")] public int GetInputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (this.forEncryption) { } throw new NullReferenceException(); } // Token: 0x06009DB1 RID: 40369 RVA: 0x0024305C File Offset: 0x0024125C [Token(Token = "0x6009DB1")] [Address(RVA = "0x205DC70", Offset = "0x205C670", VA = "0x18205DC70", Slot = "7")] public int GetOutputBlockSize() { IAsymmetricBlockCipher asymmetricBlockCipher = this.engine; if (!this.forEncryption) { } throw new NullReferenceException(); } // Token: 0x06009DB2 RID: 40370 RVA: 0x00243080 File Offset: 0x00241280 [Token(Token = "0x6009DB2")] [Address(RVA = "0x205DF40", Offset = "0x205C940", VA = "0x18205DF40", 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: 0x06009DB3 RID: 40371 RVA: 0x002430AC File Offset: 0x002412AC [Token(Token = "0x6009DB3")] [Address(RVA = "0x205D890", Offset = "0x205C290", VA = "0x18205D890")] 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: 0x06009DB4 RID: 40372 RVA: 0x00243180 File Offset: 0x00241380 [Token(Token = "0x6009DB4")] [Address(RVA = "0x205D180", Offset = "0x205BB80", VA = "0x18205D180")] 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: 0x06009DB5 RID: 40373 RVA: 0x002431AC File Offset: 0x002413AC [Token(Token = "0x6009DB5")] [Address(RVA = "0x205D270", Offset = "0x205BC70", VA = "0x18205D270")] private byte[] DecodeBlockOrRandom(byte[] input, int inOff, int inLen) { /* An exception occurred when decompiling this method (06009DB5) 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: 0x06009DB6 RID: 40374 RVA: 0x0024328C File Offset: 0x0024148C [Token(Token = "0x6009DB6")] [Address(RVA = "0x205D580", Offset = "0x205BF80", VA = "0x18205D580")] private byte[] DecodeBlock(byte[] input, int inOff, int inLen) { /* An exception occurred when decompiling this method (06009DB6) 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: 0x06009DB7 RID: 40375 RVA: 0x0024336C File Offset: 0x0024156C [Token(Token = "0x6009DB7")] [Address(RVA = "0x205DB60", Offset = "0x205C560", VA = "0x18205DB60")] private int FindStart(byte type, byte[] block) { int length = block.Length; if ((uint)1 != (uint)length) { } return -1; } // Token: 0x040067CD RID: 26573 [Token(Token = "0x40067CD")] public const string StrictLengthEnabledProperty = "BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs1.Strict"; // Token: 0x040067CE RID: 26574 [Token(Token = "0x40067CE")] private const int HeaderLength = 10; // Token: 0x040067CF RID: 26575 [Token(Token = "0x40067CF")] private static readonly bool[] strictLengthEnabled; // Token: 0x040067D0 RID: 26576 [global::Cpp2IlInjected.FieldOffset(Offset = "0x10")] [Token(Token = "0x40067D0")] private SecureRandom random; // Token: 0x040067D1 RID: 26577 [global::Cpp2IlInjected.FieldOffset(Offset = "0x18")] [Token(Token = "0x40067D1")] private IAsymmetricBlockCipher engine; // Token: 0x040067D2 RID: 26578 [global::Cpp2IlInjected.FieldOffset(Offset = "0x20")] [Token(Token = "0x40067D2")] private bool forEncryption; // Token: 0x040067D3 RID: 26579 [global::Cpp2IlInjected.FieldOffset(Offset = "0x21")] [Token(Token = "0x40067D3")] private bool forPrivateKey; // Token: 0x040067D4 RID: 26580 [global::Cpp2IlInjected.FieldOffset(Offset = "0x22")] [Token(Token = "0x40067D4")] private bool useStrictLength; // Token: 0x040067D5 RID: 26581 [global::Cpp2IlInjected.FieldOffset(Offset = "0x24")] [Token(Token = "0x40067D5")] private int pLen = (int)((ulong)4294967295L); // Token: 0x040067D6 RID: 26582 [global::Cpp2IlInjected.FieldOffset(Offset = "0x28")] [Token(Token = "0x40067D6")] private byte[] fallback; // Token: 0x040067D7 RID: 26583 [global::Cpp2IlInjected.FieldOffset(Offset = "0x30")] [Token(Token = "0x40067D7")] private byte[] blockBuffer; } }