using System; using System.Collections; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls { // Token: 0x02001AF8 RID: 6904 [Token(Token = "0x2001AF8")] public abstract class AbstractTlsServer : AbstractTlsPeer, TlsServer, TlsPeer { // Token: 0x0600ABAA RID: 43946 RVA: 0x00256090 File Offset: 0x00254290 [Token(Token = "0x600ABAA")] [Address(RVA = "0x1890500", Offset = "0x188F300", VA = "0x181890500")] public AbstractTlsServer() { DefaultTlsCipherFactory defaultTlsCipherFactory = new DefaultTlsCipherFactory(); base..ctor(); this.mCipherFactory = defaultTlsCipherFactory; } // Token: 0x0600ABAB RID: 43947 RVA: 0x002560B0 File Offset: 0x002542B0 [Token(Token = "0x600ABAB")] [Address(RVA = "0x3FFB80", Offset = "0x3FE980", VA = "0x1803FFB80")] public AbstractTlsServer(TlsCipherFactory cipherFactory) { this.mCipherFactory = cipherFactory; } // Token: 0x17001B40 RID: 6976 // (get) Token: 0x0600ABAC RID: 43948 RVA: 0x002560CC File Offset: 0x002542CC [Token(Token = "0x17001B40")] protected virtual bool AllowEncryptThenMac { [Token(Token = "0x600ABAC")] [Address(RVA = "0x460D40", Offset = "0x45FB40", VA = "0x180460D40", Slot = "38")] get { return true; } } // Token: 0x17001B41 RID: 6977 // (get) Token: 0x0600ABAD RID: 43949 RVA: 0x002560DC File Offset: 0x002542DC [Token(Token = "0x17001B41")] protected virtual bool AllowTruncatedHMac { [Token(Token = "0x600ABAD")] [Address(RVA = "0x403930", Offset = "0x402730", VA = "0x180403930", Slot = "39")] get { } } // Token: 0x0600ABAE RID: 43950 RVA: 0x002560EC File Offset: 0x002542EC [Token(Token = "0x600ABAE")] [Address(RVA = "0x188F830", Offset = "0x188E630", VA = "0x18188F830", Slot = "40")] protected virtual IDictionary CheckServerExtensions() { IDictionary dictionary = TlsExtensionsUtilities.EnsureExtensionsInitialised(this.mServerExtensions); this.mServerExtensions = dictionary; return dictionary; } // Token: 0x0600ABAF RID: 43951 [Token(Token = "0x600ABAF")] [Address(Slot = "41")] protected abstract int[] GetCipherSuites(); // Token: 0x0600ABB0 RID: 43952 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x600ABB0")] [Address(RVA = "0x188F900", Offset = "0x188E700", VA = "0x18188F900")] protected byte[] GetCompressionMethods() { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x17001B42 RID: 6978 // (get) Token: 0x0600ABB1 RID: 43953 RVA: 0x00256110 File Offset: 0x00254310 [Token(Token = "0x17001B42")] protected virtual ProtocolVersion MaximumVersion { [Token(Token = "0x600ABB1")] [Address(RVA = "0x1890560", Offset = "0x188F360", VA = "0x181890560", Slot = "42")] get { return ProtocolVersion.TLSv11; } } // Token: 0x17001B43 RID: 6979 // (get) Token: 0x0600ABB2 RID: 43954 RVA: 0x00256124 File Offset: 0x00254324 [Token(Token = "0x17001B43")] protected virtual ProtocolVersion MinimumVersion { [Token(Token = "0x600ABB2")] [Address(RVA = "0x18905C0", Offset = "0x188F3C0", VA = "0x1818905C0", Slot = "43")] get { return ProtocolVersion.TLSv10; } } // Token: 0x0600ABB3 RID: 43955 RVA: 0x00256138 File Offset: 0x00254338 [Token(Token = "0x600ABB3")] [Address(RVA = "0x1890400", Offset = "0x188F200", VA = "0x181890400", Slot = "44")] protected virtual bool SupportsClientEccCapabilities(int[] namedCurves, byte[] ecPointFormats) { if (namedCurves != 0) { int num = 0; int length = namedCurves.Length; if (num < length) { int num2 = namedCurves[num]; if (!NamedCurve.IsValid(num2) || (NamedCurve.RefersToASpecificNamedCurve(num2) && !TlsEccUtilities.IsSupportedNamedCurve(num2))) { num++; } return true; } } return TlsEccUtilities.HasAnySupportedNamedCurves(); } // Token: 0x0600ABB4 RID: 43956 RVA: 0x00256190 File Offset: 0x00254390 [Token(Token = "0x600ABB4")] [Address(RVA = "0x3F7210", Offset = "0x3F6010", VA = "0x1803F7210", Slot = "45")] public virtual void Init(TlsServerContext context) { this.mContext = context; } // Token: 0x0600ABB5 RID: 43957 RVA: 0x002561A4 File Offset: 0x002543A4 [Token(Token = "0x600ABB5")] [Address(RVA = "0x460F90", Offset = "0x45FD90", VA = "0x180460F90", Slot = "46")] public virtual void NotifyClientVersion(ProtocolVersion clientVersion) { this.mClientVersion = clientVersion; } // Token: 0x0600ABB6 RID: 43958 RVA: 0x002561B8 File Offset: 0x002543B8 [Token(Token = "0x600ABB6")] [Address(RVA = "0x1890110", Offset = "0x188EF10", VA = "0x181890110", Slot = "47")] public virtual void NotifyFallback(bool isFallback) { while (isFallback) { int[] cipherSuites = this.GetCipherSuites(); ProtocolVersion protocolVersion = this.mClientVersion; bool flag; if (!flag) { break; } } } // Token: 0x0600ABB7 RID: 43959 RVA: 0x002561DC File Offset: 0x002543DC [Token(Token = "0x600ABB7")] [Address(RVA = "0x18901B0", Offset = "0x188EFB0", VA = "0x1818901B0", Slot = "48")] public virtual void NotifyOfferedCipherSuites(int[] offeredCipherSuites) { this.mOfferedCipherSuites = offeredCipherSuites; bool flag = TlsEccUtilities.ContainsEccCipherSuites(offeredCipherSuites); this.mEccCipherSuitesOffered = flag; } // Token: 0x0600ABB8 RID: 43960 RVA: 0x00256200 File Offset: 0x00254400 [Token(Token = "0x600ABB8")] [Address(RVA = "0x4437E0", Offset = "0x4425E0", VA = "0x1804437E0", Slot = "49")] public virtual void NotifyOfferedCompressionMethods(byte[] offeredCompressionMethods) { this.mOfferedCompressionMethods = offeredCompressionMethods; } // Token: 0x0600ABB9 RID: 43961 RVA: 0x00256214 File Offset: 0x00254414 [Token(Token = "0x600ABB9")] [Address(RVA = "0x1890220", Offset = "0x188F020", VA = "0x181890220", Slot = "50")] public virtual void ProcessClientExtensions(IDictionary clientExtensions) { for (;;) { this.mClientExtensions = clientExtensions; if (clientExtensions == 0) { return; } bool flag = TlsExtensionsUtilities.HasEncryptThenMacExtension(clientExtensions); this.mEncryptThenMacOffered = flag; short maxFragmentLengthExtension = TlsExtensionsUtilities.GetMaxFragmentLengthExtension(clientExtensions); this.mMaxFragmentLengthOffered = maxFragmentLengthExtension; if (MaxFragmentLength.IsValid((byte)maxFragmentLengthExtension)) { bool flag2 = TlsExtensionsUtilities.HasTruncatedHMacExtension(clientExtensions); this.mTruncatedHMacOffered = flag2; IList signatureAlgorithmsExtension = TlsUtilities.GetSignatureAlgorithmsExtension(clientExtensions); this.mSupportedSignatureAlgorithms = signatureAlgorithmsExtension; if (signatureAlgorithmsExtension == 0 || TlsUtilities.IsSignatureAlgorithmsExtensionAllowed(this.mClientVersion)) { break; } } } int[] supportedEllipticCurvesExtension = TlsEccUtilities.GetSupportedEllipticCurvesExtension(clientExtensions); this.mNamedCurves = supportedEllipticCurvesExtension; byte[] supportedPointFormatsExtension = TlsEccUtilities.GetSupportedPointFormatsExtension(clientExtensions); this.mClientECPointFormats = supportedPointFormatsExtension; } // Token: 0x0600ABBA RID: 43962 RVA: 0x002562A0 File Offset: 0x002544A0 [Token(Token = "0x600ABBA")] [Address(RVA = "0x188FFD0", Offset = "0x188EDD0", VA = "0x18188FFD0", Slot = "51")] public virtual ProtocolVersion GetServerVersion() { int[] cipherSuites; ProtocolVersion protocolVersion3; for (;;) { ProtocolVersion maximumVersion = this.MaximumVersion; ProtocolVersion protocolVersion = this.mClientVersion; if (maximumVersion.IsEqualOrEarlierVersionOf(protocolVersion)) { cipherSuites = this.GetCipherSuites(); ProtocolVersion protocolVersion2 = this.mClientVersion; protocolVersion3 = this.mClientVersion; bool flag; if (flag) { goto IL_3F; } bool flag2; if (flag2) { break; } } } this.mServerVersion = cipherSuites; IL_3F: this.mServerVersion = protocolVersion3; return protocolVersion3; } // Token: 0x0600ABBB RID: 43963 RVA: 0x002562FC File Offset: 0x002544FC [Token(Token = "0x600ABBB")] [Address(RVA = "0x188FA50", Offset = "0x188E850", VA = "0x18188FA50", Slot = "52")] public virtual int GetSelectedCipherSuite() { ProtocolVersion minimumVersion; int num; do { IList usableSignatureAlgorithms = TlsUtilities.GetUsableSignatureAlgorithms(this.mSupportedSignatureAlgorithms); minimumVersion = this.MinimumVersion; IDictionary dictionary = this.CheckServerExtensions(); num = 0; } while (num >= this); bool flag; bool flag2; bool flag3; if (!Arrays.Contains(this.mOfferedCipherSuites, num) || (minimumVersion == 0 && flag) || !flag2 || !flag3) { num++; } throw new NullReferenceException(); } // Token: 0x0600ABBC RID: 43964 RVA: 0x00256354 File Offset: 0x00254554 [Token(Token = "0x600ABBC")] [Address(RVA = "0x188FC60", Offset = "0x188EA60", VA = "0x18188FC60", Slot = "53")] public virtual byte GetSelectedCompressionMethod() { int num; int length; do { byte[] array = new byte[1]; num = 0; length = array.Length; } while (num >= length); byte b; if (!Arrays.Contains(this.mOfferedCompressionMethods, b)) { num++; } byte b2; this.mSelectedCompressionMethod = b2; return b2; } // Token: 0x0600ABBD RID: 43965 RVA: 0x00256398 File Offset: 0x00254598 [Token(Token = "0x600ABBD")] [Address(RVA = "0x188FDA0", Offset = "0x188EBA0", VA = "0x18188FDA0", Slot = "54")] public virtual IDictionary GetServerExtensions() { if (this.mEncryptThenMacOffered && this.GetNewSessionTicket() != 0 && TlsUtilities.IsBlockCipherSuite(this.mSelectedCipherSuite)) { bool allowTruncatedHMac = this.AllowTruncatedHMac; } short num = this.mMaxFragmentLengthOffered; bool flag; if (flag && MaxFragmentLength.IsValid((byte)this.mMaxFragmentLengthOffered)) { bool allowTruncatedHMac2 = this.AllowTruncatedHMac; } if (this.mTruncatedHMacOffered && this.AllowEncryptThenMac) { bool allowTruncatedHMac3 = this.AllowTruncatedHMac; } if (this.mClientECPointFormats != (ulong)0L && TlsEccUtilities.IsEccCipherSuite(this.mSelectedCipherSuite)) { byte[] array = new byte[3]; array[0] = (byte)((ulong)1L); array[0] = (byte)((ulong)2L); this.mServerECPointFormats = array; bool allowTruncatedHMac4 = this.AllowTruncatedHMac; } return this.mServerExtensions; } // Token: 0x0600ABBE RID: 43966 RVA: 0x0025645C File Offset: 0x0025465C [Token(Token = "0x600ABBE")] [Address(RVA = "0x43E630", Offset = "0x43D430", VA = "0x18043E630", Slot = "55")] public virtual IList GetServerSupplementalData() { } // Token: 0x0600ABBF RID: 43967 [Token(Token = "0x600ABBF")] [Address(Slot = "56")] public abstract TlsCredentials GetCredentials(); // Token: 0x0600ABC0 RID: 43968 RVA: 0x0025646C File Offset: 0x0025466C [Token(Token = "0x600ABC0")] [Address(RVA = "0x43E630", Offset = "0x43D430", VA = "0x18043E630", Slot = "57")] public virtual CertificateStatus GetCertificateStatus() { } // Token: 0x0600ABC1 RID: 43969 [Token(Token = "0x600ABC1")] [Address(Slot = "58")] public abstract TlsKeyExchange GetKeyExchange(); // Token: 0x0600ABC2 RID: 43970 RVA: 0x0025647C File Offset: 0x0025467C [Token(Token = "0x600ABC2")] [Address(RVA = "0x43E630", Offset = "0x43D430", VA = "0x18043E630", Slot = "59")] public virtual CertificateRequest GetCertificateRequest() { } // Token: 0x0600ABC3 RID: 43971 RVA: 0x0025648C File Offset: 0x0025468C [Token(Token = "0x600ABC3")] [Address(RVA = "0x18903A0", Offset = "0x188F1A0", VA = "0x1818903A0", Slot = "60")] public virtual void ProcessClientSupplementalData(IList clientSupplementalData) { while (clientSupplementalData != 0) { } } // Token: 0x0600ABC4 RID: 43972 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x600ABC4")] [Address(RVA = "0x18900C0", Offset = "0x188EEC0", VA = "0x1818900C0", Slot = "61")] public virtual void NotifyClientCertificate(Certificate clientCertificate) { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x0600ABC5 RID: 43973 RVA: 0x002564A0 File Offset: 0x002546A0 [Token(Token = "0x600ABC5")] [Address(RVA = "0x188F940", Offset = "0x188E740", VA = "0x18188F940", Slot = "15")] public override TlsCompression GetCompression() { /* An exception occurred when decompiling this method (0600ABC5) ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.TlsCompression BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.AbstractTlsServer::GetCompression() ---> System.Exception: Basic block has to end with unconditional control flow. { Block_0: stloc:TlsNullCompression(var_0_05, newobj:TlsNullCompression(TlsNullCompression::.ctor)) } 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 1660 */; } // Token: 0x0600ABC6 RID: 43974 RVA: 0x002564B4 File Offset: 0x002546B4 [Token(Token = "0x600ABC6")] [Address(RVA = "0x188F860", Offset = "0x188E660", VA = "0x18188F860", Slot = "16")] public override TlsCipher GetCipher() { int num = this.mSelectedCipherSuite; int encryptionAlgorithm = TlsUtilities.GetEncryptionAlgorithm(num); int num2 = this.mSelectedCipherSuite; int macAlgorithm = TlsUtilities.GetMacAlgorithm(num2); TlsCipherFactory tlsCipherFactory = this.mCipherFactory; throw new NullReferenceException(); } // Token: 0x0600ABC7 RID: 43975 RVA: 0x002564EC File Offset: 0x002546EC [Token(Token = "0x600ABC7")] [Address(RVA = "0x188F9C0", Offset = "0x188E7C0", VA = "0x18188F9C0", Slot = "62")] public virtual NewSessionTicket GetNewSessionTicket() { byte[] emptyBytes = TlsUtilities.EmptyBytes; int num; NewSessionTicket newSessionTicket = new NewSessionTicket((long)num, emptyBytes); num = 0; return newSessionTicket; } // Token: 0x04006CC2 RID: 27842 [FieldOffset(Offset = "0x10")] [Token(Token = "0x4006CC2")] protected TlsCipherFactory mCipherFactory; // Token: 0x04006CC3 RID: 27843 [FieldOffset(Offset = "0x18")] [Token(Token = "0x4006CC3")] protected TlsServerContext mContext; // Token: 0x04006CC4 RID: 27844 [FieldOffset(Offset = "0x20")] [Token(Token = "0x4006CC4")] protected ProtocolVersion mClientVersion; // Token: 0x04006CC5 RID: 27845 [FieldOffset(Offset = "0x28")] [Token(Token = "0x4006CC5")] protected int[] mOfferedCipherSuites; // Token: 0x04006CC6 RID: 27846 [FieldOffset(Offset = "0x30")] [Token(Token = "0x4006CC6")] protected byte[] mOfferedCompressionMethods; // Token: 0x04006CC7 RID: 27847 [FieldOffset(Offset = "0x38")] [Token(Token = "0x4006CC7")] protected IDictionary mClientExtensions; // Token: 0x04006CC8 RID: 27848 [FieldOffset(Offset = "0x40")] [Token(Token = "0x4006CC8")] protected bool mEncryptThenMacOffered; // Token: 0x04006CC9 RID: 27849 [FieldOffset(Offset = "0x42")] [Token(Token = "0x4006CC9")] protected short mMaxFragmentLengthOffered; // Token: 0x04006CCA RID: 27850 [FieldOffset(Offset = "0x44")] [Token(Token = "0x4006CCA")] protected bool mTruncatedHMacOffered; // Token: 0x04006CCB RID: 27851 [FieldOffset(Offset = "0x48")] [Token(Token = "0x4006CCB")] protected IList mSupportedSignatureAlgorithms; // Token: 0x04006CCC RID: 27852 [FieldOffset(Offset = "0x50")] [Token(Token = "0x4006CCC")] protected bool mEccCipherSuitesOffered; // Token: 0x04006CCD RID: 27853 [FieldOffset(Offset = "0x58")] [Token(Token = "0x4006CCD")] protected int[] mNamedCurves; // Token: 0x04006CCE RID: 27854 [FieldOffset(Offset = "0x60")] [Token(Token = "0x4006CCE")] protected byte[] mClientECPointFormats; // Token: 0x04006CCF RID: 27855 [FieldOffset(Offset = "0x68")] [Token(Token = "0x4006CCF")] protected byte[] mServerECPointFormats; // Token: 0x04006CD0 RID: 27856 [FieldOffset(Offset = "0x70")] [Token(Token = "0x4006CD0")] protected ProtocolVersion mServerVersion; // Token: 0x04006CD1 RID: 27857 [FieldOffset(Offset = "0x78")] [Token(Token = "0x4006CD1")] protected int mSelectedCipherSuite; // Token: 0x04006CD2 RID: 27858 [FieldOffset(Offset = "0x7C")] [Token(Token = "0x4006CD2")] protected byte mSelectedCompressionMethod; // Token: 0x04006CD3 RID: 27859 [FieldOffset(Offset = "0x80")] [Token(Token = "0x4006CD3")] protected IDictionary mServerExtensions; } }