using System; using System.IO; using System.Runtime.InteropServices; 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: 0x020013D5 RID: 5077 [Token(Token = "0x20013D5")] [StructLayout(3)] public sealed class PublicKeyFactory { // Token: 0x06008154 RID: 33108 RVA: 0x001B7EB8 File Offset: 0x001B60B8 [Token(Token = "0x6008154")] [Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")] private PublicKeyFactory() { } // Token: 0x06008155 RID: 33109 RVA: 0x001B7ECC File Offset: 0x001B60CC [Token(Token = "0x6008155")] [Address(RVA = "0x48BCC0", Offset = "0x48A6C0", VA = "0x18048BCC0")] public static AsymmetricKeyParameter CreateKey(byte[] keyInfoData) { return PublicKeyFactory.CreateKey(SubjectPublicKeyInfo.GetInstance(Asn1Object.FromByteArray(keyInfoData))); } // Token: 0x06008156 RID: 33110 RVA: 0x001B7EEC File Offset: 0x001B60EC [Token(Token = "0x6008156")] [Address(RVA = "0x48A820", Offset = "0x489220", VA = "0x18048A820")] public static AsymmetricKeyParameter CreateKey(Stream inStr) { return PublicKeyFactory.CreateKey(SubjectPublicKeyInfo.GetInstance(Asn1Object.FromStream(inStr))); } // Token: 0x06008157 RID: 33111 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x6008157")] [Address(RVA = "0x48A850", Offset = "0x489250", VA = "0x18048A850")] public static AsymmetricKeyParameter CreateKey(SubjectPublicKeyInfo keyInfo) { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x06008158 RID: 33112 RVA: 0x001B7F0C File Offset: 0x001B610C [Token(Token = "0x6008158")] [Address(RVA = "0x48BCF0", Offset = "0x48A6F0", VA = "0x18048BCF0")] private static byte[] GetRawKey(SubjectPublicKeyInfo keyInfo, int expectedSize) { /* An exception occurred when decompiling this method (06008158) 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: 0x06008159 RID: 33113 RVA: 0x001B7F30 File Offset: 0x001B6130 [Token(Token = "0x6008159")] [Address(RVA = "0x48BD90", Offset = "0x48A790", VA = "0x18048BD90")] 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: 0x0600815A RID: 33114 RVA: 0x001B7F88 File Offset: 0x001B6188 [Token(Token = "0x600815A")] [Address(RVA = "0x48BF00", Offset = "0x48A900", VA = "0x18048BF00")] 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); } } }