using System; using System.Collections; 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: 0x02001A89 RID: 6793 [Token(Token = "0x2001A89")] public sealed class GeneratorUtilities { // Token: 0x0600A0A6 RID: 41126 RVA: 0x0021528C File Offset: 0x0021348C [Token(Token = "0x600A0A6")] [Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")] private GeneratorUtilities() { } // Token: 0x0600A0A7 RID: 41127 RVA: 0x002152A0 File Offset: 0x002134A0 [Token(Token = "0x600A0A7")] [Address(RVA = "0x518E90", Offset = "0x517E90", VA = "0x180518E90")] static GeneratorUtilities() { /* An exception occurred when decompiling this method (0600A0A7) 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_F31: stelem:string([mscorlib]System.String, ldloc:string[](var_140_F12), 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: 0x0600A0A8 RID: 41128 RVA: 0x002161EC File Offset: 0x002143EC [Token(Token = "0x600A0A8")] [Address(RVA = "0x5179F0", Offset = "0x5169F0", VA = "0x1805179F0")] 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: 0x0600A0A9 RID: 41129 RVA: 0x00216218 File Offset: 0x00214418 [Token(Token = "0x600A0A9")] [Address(RVA = "0x517D20", Offset = "0x516D20", VA = "0x180517D20")] 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: 0x0600A0AA RID: 41130 RVA: 0x00216264 File Offset: 0x00214464 [Token(Token = "0x600A0AA")] [Address(RVA = "0x517EE0", Offset = "0x516EE0", VA = "0x180517EE0")] 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: 0x0600A0AB RID: 41131 RVA: 0x002162B0 File Offset: 0x002144B0 [Token(Token = "0x600A0AB")] [Address(RVA = "0x517AF0", Offset = "0x516AF0", VA = "0x180517AF0")] 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: 0x0600A0AC RID: 41132 RVA: 0x0021632C File Offset: 0x0021452C [Token(Token = "0x600A0AC")] [Address(RVA = "0x5181B0", Offset = "0x5171B0", VA = "0x1805181B0")] 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: 0x0600A0AD RID: 41133 RVA: 0x00216358 File Offset: 0x00214558 [Token(Token = "0x600A0AD")] [Address(RVA = "0x518290", Offset = "0x517290", VA = "0x180518290")] 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: 0x0600A0AE RID: 41134 RVA: 0x00216384 File Offset: 0x00214584 [Token(Token = "0x600A0AE")] [Address(RVA = "0x5185D0", Offset = "0x5175D0", VA = "0x1805185D0")] public static CipherKeyGenerator GetKeyGenerator(DerObjectIdentifier oid) { return GeneratorUtilities.GetKeyGenerator(oid.identifier); } // Token: 0x0600A0AF RID: 41135 RVA: 0x002163A4 File Offset: 0x002145A4 [Token(Token = "0x600A0AF")] [Address(RVA = "0x518630", Offset = "0x517630", VA = "0x180518630")] 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: 0x0600A0B0 RID: 41136 RVA: 0x0021648C File Offset: 0x0021468C [Token(Token = "0x600A0B0")] [Address(RVA = "0x5188E0", Offset = "0x5178E0", VA = "0x1805188E0")] public static IAsymmetricCipherKeyPairGenerator GetKeyPairGenerator(DerObjectIdentifier oid) { return GeneratorUtilities.GetKeyPairGenerator(oid.identifier); } // Token: 0x0600A0B1 RID: 41137 RVA: 0x002164AC File Offset: 0x002146AC [Token(Token = "0x600A0B1")] [Address(RVA = "0x518940", Offset = "0x517940", VA = "0x180518940")] 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: 0x0600A0B2 RID: 41138 RVA: 0x002165C0 File Offset: 0x002147C0 [Token(Token = "0x600A0B2")] [Address(RVA = "0x518570", Offset = "0x517570", VA = "0x180518570")] internal static int GetDefaultKeySize(DerObjectIdentifier oid) { return GeneratorUtilities.GetDefaultKeySize(oid.identifier); } // Token: 0x0600A0B3 RID: 41139 RVA: 0x002165E0 File Offset: 0x002147E0 [Token(Token = "0x600A0B3")] [Address(RVA = "0x518370", Offset = "0x517370", VA = "0x180518370")] internal static int GetDefaultKeySize(string algorithm) { /* An exception occurred when decompiling this method (0600A0B3) 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: 0x0600A0B4 RID: 41140 RVA: 0x00216688 File Offset: 0x00214888 [Token(Token = "0x600A0B4")] [Address(RVA = "0x5180A0", Offset = "0x5170A0", VA = "0x1805180A0")] private static int FindDefaultKeySize(string canonicalName) { IDictionary dictionary = GeneratorUtilities.defaultKeySizes; IDictionary dictionary2 = GeneratorUtilities.defaultKeySizes; IDictionary dictionary3 = GeneratorUtilities.kgAlgorithms; return -1; } // Token: 0x04006B96 RID: 27542 [Token(Token = "0x4006B96")] private static readonly IDictionary kgAlgorithms; // Token: 0x04006B97 RID: 27543 [Token(Token = "0x4006B97")] private static readonly IDictionary kpgAlgorithms; // Token: 0x04006B98 RID: 27544 [Token(Token = "0x4006B98")] private static readonly IDictionary defaultKeySizes; } }