using System; using System.IO; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto; using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters; using BestHTTP.SecureProtocol.Org.BouncyCastle.Math; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Security { // Token: 0x020019B2 RID: 6578 [Token(Token = "0x20019B2")] public sealed class PublicKeyFactory { // Token: 0x06009D2E RID: 40238 RVA: 0x0020F478 File Offset: 0x0020D678 [Token(Token = "0x6009D2E")] [Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")] private PublicKeyFactory() { } // Token: 0x06009D2F RID: 40239 RVA: 0x0020F48C File Offset: 0x0020D68C [Token(Token = "0x6009D2F")] [Address(RVA = "0x1B21830", Offset = "0x1B20630", VA = "0x181B21830")] public static AsymmetricKeyParameter CreateKey(byte[] keyInfoData) { return PublicKeyFactory.CreateKey(SubjectPublicKeyInfo.GetInstance(Asn1Object.FromByteArray(keyInfoData))); } // Token: 0x06009D30 RID: 40240 RVA: 0x0020F4AC File Offset: 0x0020D6AC [Token(Token = "0x6009D30")] [Address(RVA = "0x1B20390", Offset = "0x1B1F190", VA = "0x181B20390")] public static AsymmetricKeyParameter CreateKey(Stream inStr) { return PublicKeyFactory.CreateKey(SubjectPublicKeyInfo.GetInstance(Asn1Object.FromStream(inStr))); } // Token: 0x06009D31 RID: 40241 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x6009D31")] [Address(RVA = "0x1B203C0", Offset = "0x1B1F1C0", VA = "0x181B203C0")] public static AsymmetricKeyParameter CreateKey(SubjectPublicKeyInfo keyInfo) { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x06009D32 RID: 40242 RVA: 0x0020F4CC File Offset: 0x0020D6CC [Token(Token = "0x6009D32")] [Address(RVA = "0x1B21860", Offset = "0x1B20660", VA = "0x181B21860")] private static byte[] GetRawKey(SubjectPublicKeyInfo keyInfo, int expectedSize) { /* An exception occurred when decompiling this method (06009D32) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Security.PublicKeyFactory::GetRawKey(BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509.SubjectPublicKeyInfo,System.Int32) ---> System.Exception: Basic block has to end with unconditional control flow. { Block_0: stloc:string(var_0_0B, callvirt:string(DerBitString::GetString, ldfld:DerBitString(SubjectPublicKeyInfo::keyData, ldloc:SubjectPublicKeyInfo(keyInfo)))) stloc:SecurityUtilityException(var_1_16, newobj:SecurityUtilityException(SecurityUtilityException::.ctor, ldstr:string("public key encoding has incorrect length"))) } 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: 0x06009D33 RID: 40243 RVA: 0x0020F4F0 File Offset: 0x0020D6F0 [Token(Token = "0x6009D33")] [Address(RVA = "0x1B21900", Offset = "0x1B20700", VA = "0x181B21900")] private static bool IsPkcsDHParam(Asn1Sequence seq) { Asn1Encodable asn1Encodable; if (asn1Encodable != (ulong)2L) { Asn1SequenceParser parser = seq.Parser; Asn1SequenceParser parser2 = seq.Parser; DerInteger derInteger; BigInteger value = derInteger.Value; DerInteger derInteger2; BigInteger bigInteger = BigInteger.ValueOf((long)derInteger2.Value.BitLength); return value.CompareTo(bigInteger) <= 0; } return true; } // Token: 0x06009D34 RID: 40244 RVA: 0x0020F548 File Offset: 0x0020D748 [Token(Token = "0x6009D34")] [Address(RVA = "0x1B21A70", Offset = "0x1B20870", VA = "0x181B21A70")] private static DHPublicKeyParameters ReadPkcsDHParam(DerObjectIdentifier algOid, BigInteger y, Asn1Sequence seq) { DHParameter dhparameter = new DHParameter(seq); BigInteger l = dhparameter.L; if (l == 0) { } int intValue = l.IntValue; BigInteger p = dhparameter.P; BigInteger g = dhparameter.G; int num; DHParameters dhparameters = new DHParameters(p, g, num, intValue); num = 0; return new DHPublicKeyParameters(y, dhparameters, algOid); } } }