using System; using System.Collections; using System.IO; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X9; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Agreement; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters; using BestHTTP.SecureProtocol.Org.BouncyCastle.Math; using BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC; using BestHTTP.SecureProtocol.Org.BouncyCastle.Security; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls { // Token: 0x02001C57 RID: 7255 [Token(Token = "0x2001C57")] public abstract class TlsEccUtilities { // Token: 0x0600B286 RID: 45702 RVA: 0x002694B0 File Offset: 0x002676B0 [Token(Token = "0x600B286")] [Address(RVA = "0x4A4300", Offset = "0x4A3300", VA = "0x1804A4300")] public static void AddSupportedEllipticCurvesExtension(IDictionary extensions, int[] namedCurves) { while (namedCurves == 0) { } byte[] array = TlsUtilities.EncodeUint16ArrayWithUint16Length(namedCurves); } // Token: 0x0600B287 RID: 45703 RVA: 0x002694C8 File Offset: 0x002676C8 [Token(Token = "0x600B287")] [Address(RVA = "0x4A4420", Offset = "0x4A3420", VA = "0x1804A4420")] public static void AddSupportedPointFormatsExtension(IDictionary extensions, byte[] ecPointFormats) { while (ecPointFormats != 0) { int num = 0; if (!Arrays.Contains(ecPointFormats, (byte)num)) { break; } } int num2 = 0; byte[] array = TlsUtilities.EncodeUint8ArrayWithUint8Length(Arrays.Append(ecPointFormats, (byte)num2)); } // Token: 0x0600B288 RID: 45704 RVA: 0x002694FC File Offset: 0x002676FC [Token(Token = "0x600B288")] [Address(RVA = "0x4A5550", Offset = "0x4A4550", VA = "0x1804A5550")] public static int[] GetSupportedEllipticCurvesExtension(IDictionary extensions) { /* An exception occurred when decompiling this method (0600B288) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.TlsEccUtilities::GetSupportedEllipticCurvesExtension(System.Collections.IDictionary) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_3F: stloc:TlsFatalAlert(var_6_46, newobj:TlsFatalAlert(TlsFatalAlert::.ctor, ldloc:uint64[exp:uint8](var_7))) } 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: 0x0600B289 RID: 45705 RVA: 0x00269550 File Offset: 0x00267750 [Token(Token = "0x600B289")] [Address(RVA = "0x4A56C0", Offset = "0x4A46C0", VA = "0x1804A56C0")] public static byte[] GetSupportedPointFormatsExtension(IDictionary extensions) { byte[] extensionData; for (;;) { extensionData = TlsUtilities.GetExtensionData(extensions, 11); if (extensionData == 0) { break; } byte[] array = TlsUtilities.DecodeUint8ArrayWithUint8Length(extensionData); int num = 0; if (Arrays.Contains(array, (byte)num)) { return array; } } return extensionData; } // Token: 0x0600B28A RID: 45706 RVA: 0x00269580 File Offset: 0x00267780 [Token(Token = "0x600B28A")] [Address(RVA = "0x4A47B0", Offset = "0x4A37B0", VA = "0x1804A47B0")] public static byte[] CreateSupportedEllipticCurvesExtension(int[] namedCurves) { while (namedCurves == 0) { } return TlsUtilities.EncodeUint16ArrayWithUint16Length(namedCurves); } // Token: 0x0600B28B RID: 45707 RVA: 0x00269598 File Offset: 0x00267798 [Token(Token = "0x600B28B")] [Address(RVA = "0x4A4840", Offset = "0x4A3840", VA = "0x1804A4840")] public static byte[] CreateSupportedPointFormatsExtension(byte[] ecPointFormats) { while (ecPointFormats != 0) { int num = 0; if (!Arrays.Contains(ecPointFormats, (byte)num)) { break; } } int num2 = 0; return TlsUtilities.EncodeUint8ArrayWithUint8Length(Arrays.Append(ecPointFormats, (byte)num2)); } // Token: 0x0600B28C RID: 45708 RVA: 0x002695C4 File Offset: 0x002677C4 [Token(Token = "0x600B28C")] [Address(RVA = "0x4A61C0", Offset = "0x4A51C0", VA = "0x1804A61C0")] public static int[] ReadSupportedEllipticCurvesExtension(byte[] extensionData) { /* An exception occurred when decompiling this method (0600B28C) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.TlsEccUtilities::ReadSupportedEllipticCurvesExtension(System.Byte[]) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_3D: stloc:TlsFatalAlert(var_6_44, newobj:TlsFatalAlert(TlsFatalAlert::.ctor, ldloc:uint64[exp:uint8](var_7))) } 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: 0x0600B28D RID: 45709 RVA: 0x00269618 File Offset: 0x00267818 [Token(Token = "0x600B28D")] [Address(RVA = "0x4A6300", Offset = "0x4A5300", VA = "0x1804A6300")] public static byte[] ReadSupportedPointFormatsExtension(byte[] extensionData) { byte[] array; int num; do { array = TlsUtilities.DecodeUint8ArrayWithUint8Length(extensionData); num = 0; } while (!Arrays.Contains(array, (byte)num)); return array; } // Token: 0x0600B28E RID: 45710 RVA: 0x0026963C File Offset: 0x0026783C [Token(Token = "0x600B28E")] [Address(RVA = "0x4A52B0", Offset = "0x4A42B0", VA = "0x1804A52B0")] public static string GetNameOfNamedCurve(int namedCurve) { if (TlsEccUtilities.IsSupportedNamedCurve(namedCurve)) { int num = namedCurve - 1; } throw new IndexOutOfRangeException(); } // Token: 0x0600B28F RID: 45711 RVA: 0x00269660 File Offset: 0x00267860 [Token(Token = "0x600B28F")] [Address(RVA = "0x4A5370", Offset = "0x4A4370", VA = "0x1804A5370")] public static ECDomainParameters GetParametersForNamedCurve(int namedCurve) { if (TlsEccUtilities.IsSupportedNamedCurve(namedCurve)) { int num = namedCurve - 1; X9ECParameters x9ECParameters; X9ECParameters x9ECParameters2; if (x9ECParameters != 0 || x9ECParameters2 != 0) { ECCurve curve = x9ECParameters.curve; ECPoint g = x9ECParameters.G; BigInteger n = x9ECParameters.n; BigInteger h = x9ECParameters.h; byte[] seed = x9ECParameters.seed; return new ECDomainParameters(curve, g, n, h, seed); } } throw new IndexOutOfRangeException(); } // Token: 0x0600B290 RID: 45712 RVA: 0x002696C0 File Offset: 0x002678C0 [Token(Token = "0x600B290")] [Address(RVA = "0x4A57F0", Offset = "0x4A47F0", VA = "0x1804A57F0")] public static bool HasAnySupportedNamedCurves() { throw new NullReferenceException(); } // Token: 0x0600B291 RID: 45713 RVA: 0x002696D4 File Offset: 0x002678D4 [Token(Token = "0x600B291")] [Address(RVA = "0x4A46F0", Offset = "0x4A36F0", VA = "0x1804A46F0")] public static bool ContainsEccCipherSuites(int[] cipherSuites) { int num = 0; int length = cipherSuites.Length; if (num < length) { if (!TlsEccUtilities.IsEccCipherSuite(cipherSuites[num])) { num++; } return true; } throw new NullReferenceException(); } // Token: 0x0600B292 RID: 45714 RVA: 0x00269708 File Offset: 0x00267908 [Token(Token = "0x600B292")] [Address(RVA = "0x4A58C0", Offset = "0x4A48C0", VA = "0x1804A58C0")] public static bool IsEccCipherSuite(int cipherSuite) { if (cipherSuite > 49307 && cipherSuite > 52393) { if (cipherSuite != 52396) { } return true; } if (cipherSuite > 49211) { goto IL_22; } goto IL_22; IL_22:; } // Token: 0x0600B293 RID: 45715 RVA: 0x00269738 File Offset: 0x00267938 [Token(Token = "0x600B293")] [Address(RVA = "0x4A4570", Offset = "0x4A3570", VA = "0x1804A4570")] public static bool AreOnSameCurve(ECDomainParameters a, ECDomainParameters b) { while (a != 0) { } } // Token: 0x0600B294 RID: 45716 RVA: 0x0026974C File Offset: 0x0026794C [Token(Token = "0x600B294")] [Address(RVA = "0x4A5950", Offset = "0x4A4950", VA = "0x1804A5950")] public static bool IsSupportedNamedCurve(int namedCurve) { return namedCurve <= "{il2cpp field on {'TlsEccUtilities' (constant value of type Mono.Cecil.TypeReference)}, offset 0x18}"; } // Token: 0x0600B295 RID: 45717 RVA: 0x0026976C File Offset: 0x0026796C [Token(Token = "0x600B295")] [Address(RVA = "0x4A5860", Offset = "0x4A4860", VA = "0x1804A5860")] public static bool IsCompressionPreferred(byte[] ecPointFormats, byte compressionFormat) { if (ecPointFormats != 0) { int length = ecPointFormats.Length; int num = 0; if (num < length) { byte b; if (b != compressionFormat) { num++; } return true; } } throw new IndexOutOfRangeException(); } // Token: 0x0600B296 RID: 45718 RVA: 0x0026979C File Offset: 0x0026799C [Token(Token = "0x600B296")] [Address(RVA = "0x4A63C0", Offset = "0x4A53C0", VA = "0x1804A63C0")] public static byte[] SerializeECFieldElement(int fieldSize, BigInteger x) { return BigIntegers.AsUnsignedByteArray(fieldSize, x); } // Token: 0x0600B297 RID: 45719 RVA: 0x002697B0 File Offset: 0x002679B0 [Token(Token = "0x600B297")] [Address(RVA = "0x4A63E0", Offset = "0x4A53E0", VA = "0x1804A63E0")] public static byte[] SerializeECPoint(byte[] ecPointFormats, ECPoint point) { bool flag = point.SatisfiesOrder(); bool flag2; if (!flag2) { bool flag3; if (!flag3 || ecPointFormats == 0) { goto IL_43; } int length = ecPointFormats.Length; int num = 0; if (num >= length) { goto IL_43; } num++; } if (ecPointFormats != 0) { int length2 = ecPointFormats.Length; int num2 = 0; if (num2 < length2) { num2++; } } IL_43: bool flag4 = point.SatisfiesCurveEquation(); throw new NullReferenceException(); } // Token: 0x0600B298 RID: 45720 RVA: 0x00269810 File Offset: 0x00267A10 [Token(Token = "0x600B298")] [Address(RVA = "0x4A6550", Offset = "0x4A5550", VA = "0x1804A6550")] public static byte[] SerializeECPublicKey(byte[] ecPointFormats, ECPublicKeyParameters keyParameters) { ECPoint q = keyParameters.q; return TlsEccUtilities.SerializeECPoint(ecPointFormats, q); } // Token: 0x0600B299 RID: 45721 RVA: 0x00269834 File Offset: 0x00267A34 [Token(Token = "0x600B299")] [Address(RVA = "0x4A4900", Offset = "0x4A3900", VA = "0x1804A4900")] public static BigInteger DeserializeECFieldElement(int fieldSize, byte[] encoding) { return new BigInteger(1, encoding); } // Token: 0x0600B29A RID: 45722 RVA: 0x00269858 File Offset: 0x00267A58 [Token(Token = "0x600B29A")] [Address(RVA = "0x4A49B0", Offset = "0x4A39B0", VA = "0x1804A49B0")] public static ECPoint DeserializeECPoint(byte[] ecPointFormats, ECCurve curve, byte[] encoding) { /* An exception occurred when decompiling this method (0600B29A) ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC.ECPoint BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.TlsEccUtilities::DeserializeECPoint(System.Byte[],BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC.ECCurve,System.Byte[]) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_4C: stloc:TlsFatalAlert(var_8_53, newobj:TlsFatalAlert(TlsFatalAlert::.ctor, ldloc:uint64[exp:uint8](var_9))) } 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: 0x0600B29B RID: 45723 RVA: 0x002698BC File Offset: 0x00267ABC [Token(Token = "0x600B29B")] [Address(RVA = "0x4A4BB0", Offset = "0x4A3BB0", VA = "0x1804A4BB0")] public static ECPublicKeyParameters DeserializeECPublicKey(byte[] ecPointFormats, ECDomainParameters curve_params, byte[] encoding) { ECCurve curve = curve_params.curve; return new ECPublicKeyParameters(TlsEccUtilities.DeserializeECPoint(ecPointFormats, curve, encoding), curve_params); } // Token: 0x0600B29C RID: 45724 RVA: 0x002698E4 File Offset: 0x00267AE4 [Token(Token = "0x600B29C")] [Address(RVA = "0x4A4590", Offset = "0x4A3590", VA = "0x1804A4590")] public static byte[] CalculateECDHBasicAgreement(ECPublicKeyParameters publicKey, ECPrivateKeyParameters privateKey) { ECDHBasicAgreement ecdhbasicAgreement = new ECDHBasicAgreement(); BigInteger bigInteger = ecdhbasicAgreement.CalculateAgreement(privateKey); int fieldSize = ecdhbasicAgreement.GetFieldSize(); byte[] array; return array; } // Token: 0x0600B29D RID: 45725 RVA: 0x00269910 File Offset: 0x00267B10 [Token(Token = "0x600B29D")] [Address(RVA = "0x4A4CB0", Offset = "0x4A3CB0", VA = "0x1804A4CB0")] public static AsymmetricCipherKeyPair GenerateECKeyPair(SecureRandom random, ECDomainParameters ecParams) { ECKeyPairGenerator eckeyPairGenerator = new ECKeyPairGenerator(); ECKeyGenerationParameters eckeyGenerationParameters = new ECKeyGenerationParameters(ecParams, random); eckeyPairGenerator.Init(eckeyGenerationParameters); return eckeyPairGenerator.GenerateKeyPair(); } // Token: 0x0600B29E RID: 45726 RVA: 0x00269940 File Offset: 0x00267B40 [Token(Token = "0x600B29E")] [Address(RVA = "0x4A4D60", Offset = "0x4A3D60", VA = "0x1804A4D60")] public static ECPrivateKeyParameters GenerateEphemeralClientKeyExchange(SecureRandom random, byte[] ecPointFormats, ECDomainParameters ecParams, Stream output) { for (;;) { ECKeyPairGenerator eckeyPairGenerator = new ECKeyPairGenerator(); ECKeyGenerationParameters eckeyGenerationParameters = new ECKeyGenerationParameters(ecParams, random); eckeyPairGenerator.Init(eckeyGenerationParameters); AsymmetricCipherKeyPair asymmetricCipherKeyPair = eckeyPairGenerator.GenerateKeyPair(); AsymmetricKeyParameter publicParameter = asymmetricCipherKeyPair.publicParameter; if (publicParameter != 0) { byte[] array; TlsUtilities.WriteOpaque8(array, output); AsymmetricKeyParameter privateParameter = asymmetricCipherKeyPair.privateParameter; if (privateParameter == 0 || privateParameter != 0) { break; } } } throw new NullReferenceException(); } // Token: 0x0600B29F RID: 45727 RVA: 0x0026999C File Offset: 0x00267B9C [Token(Token = "0x600B29F")] [Address(RVA = "0x4A4F80", Offset = "0x4A3F80", VA = "0x1804A4F80")] internal static ECPrivateKeyParameters GenerateEphemeralServerKeyExchange(SecureRandom random, int[] namedCurves, byte[] ecPointFormats, Stream output) { ECDomainParameters parametersForNamedCurve; do { if (namedCurves != 0) { int num = 0; int num2 = 0; int length = namedCurves.Length; if (num2 < length) { int num3 = namedCurves[num]; if (num3 - 1 > 27) { } if (!TlsEccUtilities.IsSupportedNamedCurve(num3)) { num++; } } if (!Arrays.Contains(namedCurves, 65281) && !Arrays.Contains(namedCurves, 65282)) { continue; } } parametersForNamedCurve = TlsEccUtilities.GetParametersForNamedCurve(23); } while (parametersForNamedCurve == 0 || parametersForNamedCurve <= (ulong)1L); TlsUtilities.CheckUint16(23); TlsUtilities.WriteUint16(23, output); TlsEccUtilities.WriteExplicitECParameters(ecPointFormats, parametersForNamedCurve, output); return TlsEccUtilities.GenerateEphemeralClientKeyExchange(random, ecPointFormats, parametersForNamedCurve, output); } // Token: 0x0600B2A0 RID: 45728 RVA: 0x00269A2C File Offset: 0x00267C2C [Token(Token = "0x600B2A0")] [Address(RVA = "0x4A65C0", Offset = "0x4A55C0", VA = "0x1804A65C0")] public static ECPublicKeyParameters ValidateECPublicKey(ECPublicKeyParameters key) { return key; } // Token: 0x0600B2A1 RID: 45729 RVA: 0x00269A3C File Offset: 0x00267C3C [Token(Token = "0x600B2A1")] [Address(RVA = "0x4A59D0", Offset = "0x4A49D0", VA = "0x1804A59D0")] public static int ReadECExponent(int fieldSize, Stream input) { int intValue; for (;;) { BigInteger bigInteger = TlsEccUtilities.ReadECParameter(input); if (bigInteger.BitLength < 32) { intValue = bigInteger.IntValue; if (intValue > 0 && intValue < fieldSize) { break; } } } return intValue; } // Token: 0x0600B2A2 RID: 45730 RVA: 0x00269A6C File Offset: 0x00267C6C [Token(Token = "0x600B2A2")] [Address(RVA = "0x4A5A90", Offset = "0x4A4A90", VA = "0x1804A5A90")] public static BigInteger ReadECFieldElement(int fieldSize, Stream input) { /* An exception occurred when decompiling this method (0600B2A2) ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Math.BigInteger BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.TlsEccUtilities::ReadECFieldElement(System.Int32,System.IO.Stream) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_24: stloc:TlsFatalAlert(var_2_2A, newobj:TlsFatalAlert(TlsFatalAlert::.ctor, ldloc:uint64[exp:uint8](var_3))) } 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: 0x0600B2A3 RID: 45731 RVA: 0x00269AA4 File Offset: 0x00267CA4 [Token(Token = "0x600B2A3")] [Address(RVA = "0x4A5BA0", Offset = "0x4A4BA0", VA = "0x1804A5BA0")] public static BigInteger ReadECParameter(Stream input) { byte[] array = TlsUtilities.ReadOpaque8(input); return new BigInteger(1, array); } // Token: 0x0600B2A4 RID: 45732 RVA: 0x00269AC0 File Offset: 0x00267CC0 [Token(Token = "0x600B2A4")] [Address(RVA = "0x4A5C30", Offset = "0x4A4C30", VA = "0x1804A5C30")] public static ECDomainParameters ReadECParameters(int[] namedCurves, byte[] ecPointFormats, Stream input) { byte b = TlsUtilities.ReadUint8(input); int num = TlsUtilities.ReadUint16(input); num += -65281; if (num > 1) { TlsEccUtilities.CheckNamedCurve(namedCurves, num); ECDomainParameters parametersForNamedCurve = TlsEccUtilities.GetParametersForNamedCurve(num); uint num2; TlsEccUtilities.CheckNamedCurve(namedCurves, (int)num2); F2mCurve f2mCurve; ECPoint ecpoint; BigInteger bigInteger; BigInteger bigInteger2; ECDomainParameters ecdomainParameters = new ECDomainParameters(f2mCurve, ecpoint, bigInteger, bigInteger2); BigInteger bigInteger3; int bitLength = bigInteger3.BitLength; int bitLength2 = bigInteger3.BitLength; int num3 = 0; BigInteger bigInteger4; BigInteger bigInteger5; FpCurve fpCurve = new FpCurve(bigInteger3, num3, bigInteger, bigInteger4, bigInteger5); ECPoint ecpoint2; return new ECDomainParameters(fpCurve, ecpoint2, bigInteger4, bigInteger5); } ulong num4; TlsFatalAlert tlsFatalAlert = new TlsFatalAlert((byte)num4); ulong num5; TlsFatalAlert tlsFatalAlert2 = new TlsFatalAlert((byte)num5); throw new NullReferenceException(); } // Token: 0x0600B2A5 RID: 45733 RVA: 0x00269B68 File Offset: 0x00267D68 [Token(Token = "0x600B2A5")] [Address(RVA = "0x4A4650", Offset = "0x4A3650", VA = "0x1804A4650")] private static void CheckNamedCurve(int[] namedCurves, int namedCurve) { while (namedCurves != 0 && !Arrays.Contains(namedCurves, namedCurve)) { } } // Token: 0x0600B2A6 RID: 45734 RVA: 0x00269B84 File Offset: 0x00267D84 [Token(Token = "0x600B2A6")] [Address(RVA = "0x4A65D0", Offset = "0x4A55D0", VA = "0x1804A65D0")] public static void WriteECExponent(int k, Stream output) { TlsUtilities.WriteOpaque8(BigIntegers.AsUnsignedByteArray(BigInteger.ValueOf((long)k)), output); } // Token: 0x0600B2A7 RID: 45735 RVA: 0x00269BA4 File Offset: 0x00267DA4 [Token(Token = "0x600B2A7")] [Address(RVA = "0x4A6760", Offset = "0x4A5760", VA = "0x1804A6760")] public static void WriteECFieldElement(ECFieldElement x, Stream output) { } // Token: 0x0600B2A8 RID: 45736 RVA: 0x00269BB8 File Offset: 0x00267DB8 [Token(Token = "0x600B2A8")] [Address(RVA = "0x4A66B0", Offset = "0x4A56B0", VA = "0x1804A66B0")] public static void WriteECFieldElement(int fieldSize, BigInteger x, Stream output) { byte[] array; TlsUtilities.WriteOpaque8(array, output); } // Token: 0x0600B2A9 RID: 45737 RVA: 0x00269BCC File Offset: 0x00267DCC [Token(Token = "0x600B2A9")] [Address(RVA = "0x4A67F0", Offset = "0x4A57F0", VA = "0x1804A67F0")] public static void WriteECParameter(BigInteger x, Stream output) { TlsUtilities.WriteOpaque8(BigIntegers.AsUnsignedByteArray(x), output); } // Token: 0x0600B2AA RID: 45738 RVA: 0x00269BE8 File Offset: 0x00267DE8 [Token(Token = "0x600B2AA")] [Address(RVA = "0x4A6900", Offset = "0x4A5900", VA = "0x1804A6900")] public static void WriteExplicitECParameters(byte[] ecPointFormats, ECDomainParameters ecParameters, Stream output) { /* An exception occurred when decompiling this method (0600B2AA) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.TlsEccUtilities::WriteExplicitECParameters(System.Byte[],BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters.ECDomainParameters,System.IO.Stream) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_E8: stloc:ArgumentException(var_15_F2, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Only trinomial and pentomial curves are supported"))) } 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: 0x0600B2AB RID: 45739 RVA: 0x00269CE8 File Offset: 0x00267EE8 [Token(Token = "0x600B2AB")] [Address(RVA = "0x4A6860", Offset = "0x4A5860", VA = "0x1804A6860")] public static void WriteECPoint(byte[] ecPointFormats, ECPoint point, Stream output) { TlsUtilities.WriteOpaque8(TlsEccUtilities.SerializeECPoint(ecPointFormats, point), output); } // Token: 0x0600B2AC RID: 45740 RVA: 0x00269D04 File Offset: 0x00267F04 [Token(Token = "0x600B2AC")] [Address(RVA = "0x4A6E00", Offset = "0x4A5E00", VA = "0x1804A6E00")] public static void WriteNamedECParameters(int namedCurve, Stream output) { TlsUtilities.CheckUint16(namedCurve); TlsUtilities.WriteUint16(namedCurve, output); } // Token: 0x0600B2AD RID: 45741 RVA: 0x00269D20 File Offset: 0x00267F20 [Token(Token = "0x600B2AD")] [Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")] protected TlsEccUtilities() { } // Token: 0x0600B2AE RID: 45742 RVA: 0x00269D34 File Offset: 0x00267F34 // Note: this type is marked as 'beforefieldinit'. [Token(Token = "0x600B2AE")] [Address(RVA = "0x4A6EB0", Offset = "0x4A5EB0", VA = "0x1804A6EB0")] static TlsEccUtilities() { string[] array = new string[28]; if ("sect163k1" != 0) { } array[0] = "sect163k1"; if ("sect163r1" != 0) { } array[1] = "sect163r1"; if ("sect163r2" != 0) { } array[2] = "sect163r2"; if ("sect193r1" != 0) { } array[3] = "sect193r1"; if ("sect193r2" != 0) { } array[4] = "sect193r2"; if ("sect233k1" != 0) { } array[5] = "sect233k1"; if ("sect233r1" != 0) { } array[6] = "sect233r1"; if ("sect239k1" != 0) { } array[7] = "sect239k1"; if ("sect283k1" != 0) { } array[8] = "sect283k1"; if ("sect283r1" != 0) { } array[9] = "sect283r1"; if ("sect409k1" != 0) { } array[10] = "sect409k1"; if ("sect409r1" != 0) { } array[11] = "sect409r1"; if ("sect571k1" != 0) { } array[12] = "sect571k1"; if ("sect571r1" != 0) { } array[13] = "sect571r1"; if ("secp160k1" != 0) { } array[14] = "secp160k1"; if ("secp160r1" != 0) { } array[15] = "secp160r1"; if ("secp160r2" != 0) { } array[16] = "secp160r2"; if ("secp192k1" != 0) { } array[17] = "secp192k1"; if ("secp192r1" != 0) { } array[18] = "secp192r1"; if ("secp224k1" != 0) { } array[19] = "secp224k1"; if ("secp224r1" != 0) { } array[20] = "secp224r1"; if ("secp256k1" != 0) { } array[21] = "secp256k1"; if ("secp256r1" != 0) { } array[22] = "secp256r1"; if ("secp384r1" != 0) { } array[23] = "secp384r1"; if ("secp521r1" != 0) { } array[24] = "secp521r1"; if ("brainpoolP256r1" != 0) { } array[25] = "brainpoolP256r1"; if ("brainpoolP384r1" != 0) { } array[26] = "brainpoolP384r1"; if ("brainpoolP512r1" != 0) { } array[27] = "brainpoolP512r1"; } // Token: 0x040071D3 RID: 29139 [Token(Token = "0x40071D3")] private static readonly string[] CurveNames; } }