using System; using System.Collections; using System.Runtime.InteropServices; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Security { // Token: 0x020013CC RID: 5068 [Token(Token = "0x20013CC")] [StructLayout(3)] public sealed class GeneratorUtilities { // Token: 0x060080FE RID: 33022 RVA: 0x001B4FDC File Offset: 0x001B31DC [Token(Token = "0x60080FE")] [Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")] private GeneratorUtilities() { } // Token: 0x060080FF RID: 33023 RVA: 0x001B4FF0 File Offset: 0x001B31F0 [Token(Token = "0x60080FF")] [Address(RVA = "0x47B860", Offset = "0x47A260", VA = "0x18047B860")] static GeneratorUtilities() { /* An exception occurred when decompiling this method (060080FF) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Security.GeneratorUtilities::.cctor() ---> System.Exception: Basic block has to end with unconditional control flow. { IL_D17: stelem:string([mscorlib]System.String, ldloc:string[](var_106_CF8), ldc.i4:int32(1), ldstr:string("HMACSHA1")) } 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: 0x06008100 RID: 33024 RVA: 0x001B5D20 File Offset: 0x001B3F20 [Token(Token = "0x6008100")] [Address(RVA = "0x47A3C0", Offset = "0x478DC0", VA = "0x18047A3C0")] private static void AddDefaultKeySizeEntries(int size, params string[] algorithms) { int num = 0; int length = algorithms.Length; if (num < length) { IDictionary dictionary = GeneratorUtilities.defaultKeySizes; num++; } } // Token: 0x06008101 RID: 33025 RVA: 0x001B5D4C File Offset: 0x001B3F4C [Token(Token = "0x6008101")] [Address(RVA = "0x47A6F0", Offset = "0x4790F0", VA = "0x18047A6F0")] private static void AddKgAlgorithm(string canonicalName, params object[] aliases) { IDictionary dictionary = GeneratorUtilities.kgAlgorithms; string text = Platform.ToUpperInvariant(canonicalName); int num = 0; int length = aliases.Length; if (num < length) { object obj = aliases[num]; IDictionary dictionary2 = GeneratorUtilities.kgAlgorithms; int hashCode = obj.GetHashCode(); num++; } } // Token: 0x06008102 RID: 33026 RVA: 0x001B5D98 File Offset: 0x001B3F98 [Token(Token = "0x6008102")] [Address(RVA = "0x47A8B0", Offset = "0x4792B0", VA = "0x18047A8B0")] private static void AddKpgAlgorithm(string canonicalName, params object[] aliases) { IDictionary dictionary = GeneratorUtilities.kpgAlgorithms; string text = Platform.ToUpperInvariant(canonicalName); int num = 0; int length = aliases.Length; if (num < length) { object obj = aliases[num]; IDictionary dictionary2 = GeneratorUtilities.kpgAlgorithms; int hashCode = obj.GetHashCode(); num++; } } // Token: 0x06008103 RID: 33027 RVA: 0x001B5DE4 File Offset: 0x001B3FE4 [Token(Token = "0x6008103")] [Address(RVA = "0x47A4C0", Offset = "0x478EC0", VA = "0x18047A4C0")] private static void AddHMacKeyGenerator(string algorithm, params object[] aliases) { string text = "HMAC" + algorithm; IDictionary dictionary = GeneratorUtilities.kgAlgorithms; IDictionary dictionary2 = GeneratorUtilities.kgAlgorithms; string text2 = "HMAC-" + algorithm; IDictionary dictionary3 = GeneratorUtilities.kgAlgorithms; string text3 = "HMAC/" + algorithm; int num = 0; int length = aliases.Length; if (num < length) { object obj = aliases[num]; IDictionary dictionary4 = GeneratorUtilities.kgAlgorithms; int hashCode = obj.GetHashCode(); num++; } } // Token: 0x06008104 RID: 33028 RVA: 0x001B5E60 File Offset: 0x001B4060 [Token(Token = "0x6008104")] [Address(RVA = "0x47AB80", Offset = "0x479580", VA = "0x18047AB80")] internal static string GetCanonicalKeyGeneratorAlgorithm(string algorithm) { string text; for (;;) { IDictionary dictionary = GeneratorUtilities.kgAlgorithms; text = Platform.ToUpperInvariant(algorithm); if (text == 0) { break; } if (text != 0) { goto Block_1; } } return text; Block_1: throw new NullReferenceException(); } // Token: 0x06008105 RID: 33029 RVA: 0x001B5E8C File Offset: 0x001B408C [Token(Token = "0x6008105")] [Address(RVA = "0x47AC60", Offset = "0x479660", VA = "0x18047AC60")] internal static string GetCanonicalKeyPairGeneratorAlgorithm(string algorithm) { string text; for (;;) { IDictionary dictionary = GeneratorUtilities.kpgAlgorithms; text = Platform.ToUpperInvariant(algorithm); if (text == 0) { break; } if (text != 0) { goto Block_1; } } return text; Block_1: throw new NullReferenceException(); } // Token: 0x06008106 RID: 33030 RVA: 0x001B5EB8 File Offset: 0x001B40B8 [Token(Token = "0x6008106")] [Address(RVA = "0x47AFA0", Offset = "0x4799A0", VA = "0x18047AFA0")] public static CipherKeyGenerator GetKeyGenerator(DerObjectIdentifier oid) { return GeneratorUtilities.GetKeyGenerator(oid.identifier); } // Token: 0x06008107 RID: 33031 RVA: 0x001B5ED8 File Offset: 0x001B40D8 [Token(Token = "0x6008107")] [Address(RVA = "0x47B000", Offset = "0x479A00", VA = "0x18047B000")] public static CipherKeyGenerator GetKeyGenerator(string algorithm) { string canonicalKeyGeneratorAlgorithm = GeneratorUtilities.GetCanonicalKeyGeneratorAlgorithm(algorithm); if (canonicalKeyGeneratorAlgorithm != 0) { int num = GeneratorUtilities.FindDefaultKeySize(canonicalKeyGeneratorAlgorithm); if (num == -1) { goto IL_6C; } if (!string.Equals(canonicalKeyGeneratorAlgorithm, "DES")) { if (!string.Equals(canonicalKeyGeneratorAlgorithm, "DESEDE") && !string.Equals(canonicalKeyGeneratorAlgorithm, "DESEDE3")) { return new CipherKeyGenerator(num); } DesEdeKeyGenerator desEdeKeyGenerator = new DesEdeKeyGenerator(num); } DesKeyGenerator desKeyGenerator = new DesKeyGenerator(num); } SecurityUtilityException ex = new SecurityUtilityException("KeyGenerator " + algorithm + " not recognised."); IL_6C: string[] array = new string[5]; throw new NullReferenceException(); } // Token: 0x06008108 RID: 33032 RVA: 0x001B5FC0 File Offset: 0x001B41C0 [Token(Token = "0x6008108")] [Address(RVA = "0x47B2B0", Offset = "0x479CB0", VA = "0x18047B2B0")] public static IAsymmetricCipherKeyPairGenerator GetKeyPairGenerator(DerObjectIdentifier oid) { return GeneratorUtilities.GetKeyPairGenerator(oid.identifier); } // Token: 0x06008109 RID: 33033 RVA: 0x001B5FE0 File Offset: 0x001B41E0 [Token(Token = "0x6008109")] [Address(RVA = "0x47B310", Offset = "0x479D10", VA = "0x18047B310")] public static IAsymmetricCipherKeyPairGenerator GetKeyPairGenerator(string algorithm) { string text; do { IDictionary dictionary = GeneratorUtilities.kpgAlgorithms; text = Platform.ToUpperInvariant(algorithm); } while (text == 0 || text == 0); if (text == 0) { if (text == 0) { bool flag = Platform.StartsWith(text, "EC"); if (!flag) { if (!flag) { if (!flag) { if (!flag) { if (!flag) { if (!flag) { if (!flag) { if (!flag) { string[] array = new string[5]; throw new NullReferenceException(); } X448KeyPairGenerator x448KeyPairGenerator = new X448KeyPairGenerator(); } X25519KeyPairGenerator x25519KeyPairGenerator = new X25519KeyPairGenerator(); } RsaKeyPairGenerator rsaKeyPairGenerator = new RsaKeyPairGenerator(); } Gost3410KeyPairGenerator gost3410KeyPairGenerator = new Gost3410KeyPairGenerator(); } ElGamalKeyPairGenerator elGamalKeyPairGenerator = new ElGamalKeyPairGenerator(); } Ed448KeyPairGenerator ed448KeyPairGenerator = new Ed448KeyPairGenerator(); } Ed25519KeyPairGenerator ed25519KeyPairGenerator = new Ed25519KeyPairGenerator(); } ECKeyPairGenerator eckeyPairGenerator = new ECKeyPairGenerator(text); } DsaKeyPairGenerator dsaKeyPairGenerator = new DsaKeyPairGenerator(); } DHKeyPairGenerator dhkeyPairGenerator = new DHKeyPairGenerator(); throw new NullReferenceException(); } // Token: 0x0600810A RID: 33034 RVA: 0x001B60F4 File Offset: 0x001B42F4 [Token(Token = "0x600810A")] [Address(RVA = "0x47AF40", Offset = "0x479940", VA = "0x18047AF40")] internal static int GetDefaultKeySize(DerObjectIdentifier oid) { return GeneratorUtilities.GetDefaultKeySize(oid.identifier); } // Token: 0x0600810B RID: 33035 RVA: 0x001B6114 File Offset: 0x001B4314 [Token(Token = "0x600810B")] [Address(RVA = "0x47AD40", Offset = "0x479740", VA = "0x18047AD40")] internal static int GetDefaultKeySize(string algorithm) { /* An exception occurred when decompiling this method (0600810B) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Security.GeneratorUtilities::GetDefaultKeySize(System.String) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_85: stloc:SecurityUtilityException(var_4_9A, newobj:SecurityUtilityException(SecurityUtilityException::.ctor, call:string(string::Concat, ldstr:string("KeyGenerator "), ldloc:string(algorithm), ldstr:string(" not recognised.")))) } 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: 0x0600810C RID: 33036 RVA: 0x001B61BC File Offset: 0x001B43BC [Token(Token = "0x600810C")] [Address(RVA = "0x47AA70", Offset = "0x479470", VA = "0x18047AA70")] private static int FindDefaultKeySize(string canonicalName) { IDictionary dictionary = GeneratorUtilities.defaultKeySizes; IDictionary dictionary2 = GeneratorUtilities.defaultKeySizes; IDictionary dictionary3 = GeneratorUtilities.kgAlgorithms; return -1; } // Token: 0x04005B9A RID: 23450 [Token(Token = "0x4005B9A")] private static readonly IDictionary kgAlgorithms; // Token: 0x04005B9B RID: 23451 [Token(Token = "0x4005B9B")] private static readonly IDictionary kpgAlgorithms; // Token: 0x04005B9C RID: 23452 [Token(Token = "0x4005B9C")] private static readonly IDictionary defaultKeySizes; } }