using System; using System.Collections; using System.Runtime.InteropServices; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls { // Token: 0x0200151B RID: 5403 [Token(Token = "0x200151B")] [StructLayout(3)] public abstract class AbstractTlsServer : AbstractTlsPeer, TlsServer, TlsPeer { // Token: 0x06008FD0 RID: 36816 RVA: 0x001FE9C8 File Offset: 0x001FCBC8 [Token(Token = "0x6008FD0")] [Address(RVA = "0x1E73300", Offset = "0x1E71D00", VA = "0x181E73300")] public AbstractTlsServer() { DefaultTlsCipherFactory defaultTlsCipherFactory = new DefaultTlsCipherFactory(); base..ctor(); this.mCipherFactory = defaultTlsCipherFactory; } // Token: 0x06008FD1 RID: 36817 RVA: 0x001FE9E8 File Offset: 0x001FCBE8 [Token(Token = "0x6008FD1")] [Address(RVA = "0x3C3A30", Offset = "0x3C2430", VA = "0x1803C3A30")] public AbstractTlsServer(TlsCipherFactory cipherFactory) { this.mCipherFactory = cipherFactory; } // Token: 0x1700173F RID: 5951 // (get) Token: 0x06008FD2 RID: 36818 RVA: 0x001FEA04 File Offset: 0x001FCC04 [Token(Token = "0x1700173F")] protected virtual bool AllowEncryptThenMac { [Token(Token = "0x6008FD2")] [Address(RVA = "0x4405A0", Offset = "0x43EFA0", VA = "0x1804405A0", Slot = "38")] get { return true; } } // Token: 0x17001740 RID: 5952 // (get) Token: 0x06008FD3 RID: 36819 RVA: 0x001FEA14 File Offset: 0x001FCC14 [Token(Token = "0x17001740")] protected virtual bool AllowTruncatedHMac { [Token(Token = "0x6008FD3")] [Address(RVA = "0x413970", Offset = "0x412370", VA = "0x180413970", Slot = "39")] get { } } // Token: 0x06008FD4 RID: 36820 RVA: 0x001FEA24 File Offset: 0x001FCC24 [Token(Token = "0x6008FD4")] [Address(RVA = "0x1E725C0", Offset = "0x1E70FC0", VA = "0x181E725C0", Slot = "40")] protected virtual IDictionary CheckServerExtensions() { IDictionary dictionary = TlsExtensionsUtilities.EnsureExtensionsInitialised(this.mServerExtensions); this.mServerExtensions = dictionary; return dictionary; } // Token: 0x06008FD5 RID: 36821 [Token(Token = "0x6008FD5")] [Address(Slot = "41")] protected abstract int[] GetCipherSuites(); // Token: 0x06008FD6 RID: 36822 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x6008FD6")] [Address(RVA = "0x1E72700", Offset = "0x1E71100", VA = "0x181E72700")] protected byte[] GetCompressionMethods() { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x17001741 RID: 5953 // (get) Token: 0x06008FD7 RID: 36823 RVA: 0x001FEA48 File Offset: 0x001FCC48 [Token(Token = "0x17001741")] protected virtual ProtocolVersion MaximumVersion { [Token(Token = "0x6008FD7")] [Address(RVA = "0x1E73360", Offset = "0x1E71D60", VA = "0x181E73360", Slot = "42")] get { return ProtocolVersion.TLSv11; } } // Token: 0x17001742 RID: 5954 // (get) Token: 0x06008FD8 RID: 36824 RVA: 0x001FEA5C File Offset: 0x001FCC5C [Token(Token = "0x17001742")] protected virtual ProtocolVersion MinimumVersion { [Token(Token = "0x6008FD8")] [Address(RVA = "0x1E733C0", Offset = "0x1E71DC0", VA = "0x181E733C0", Slot = "43")] get { return ProtocolVersion.TLSv10; } } // Token: 0x06008FD9 RID: 36825 RVA: 0x001FEA70 File Offset: 0x001FCC70 [Token(Token = "0x6008FD9")] [Address(RVA = "0x1E73200", Offset = "0x1E71C00", VA = "0x181E73200", 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: 0x06008FDA RID: 36826 RVA: 0x001FEAC8 File Offset: 0x001FCCC8 [Token(Token = "0x6008FDA")] [Address(RVA = "0x3C1280", Offset = "0x3BFC80", VA = "0x1803C1280", Slot = "45")] public virtual void Init(TlsServerContext context) { this.mContext = context; } // Token: 0x06008FDB RID: 36827 RVA: 0x001FEADC File Offset: 0x001FCCDC [Token(Token = "0x6008FDB")] [Address(RVA = "0x3C1260", Offset = "0x3BFC60", VA = "0x1803C1260", Slot = "46")] public virtual void NotifyClientVersion(ProtocolVersion clientVersion) { this.mClientVersion = clientVersion; } // Token: 0x06008FDC RID: 36828 RVA: 0x001FEAF0 File Offset: 0x001FCCF0 [Token(Token = "0x6008FDC")] [Address(RVA = "0x1E72F10", Offset = "0x1E71910", VA = "0x181E72F10", Slot = "47")] public virtual void NotifyFallback(bool isFallback) { while (isFallback) { int[] cipherSuites = this.GetCipherSuites(); ProtocolVersion protocolVersion = this.mClientVersion; bool flag; if (!flag) { break; } } } // Token: 0x06008FDD RID: 36829 RVA: 0x001FEB14 File Offset: 0x001FCD14 [Token(Token = "0x6008FDD")] [Address(RVA = "0x1E72FB0", Offset = "0x1E719B0", VA = "0x181E72FB0", Slot = "48")] public virtual void NotifyOfferedCipherSuites(int[] offeredCipherSuites) { this.mOfferedCipherSuites = offeredCipherSuites; bool flag = TlsEccUtilities.ContainsEccCipherSuites(offeredCipherSuites); this.mEccCipherSuitesOffered = flag; } // Token: 0x06008FDE RID: 36830 RVA: 0x001FEB38 File Offset: 0x001FCD38 [Token(Token = "0x6008FDE")] [Address(RVA = "0x3C1290", Offset = "0x3BFC90", VA = "0x1803C1290", Slot = "49")] public virtual void NotifyOfferedCompressionMethods(byte[] offeredCompressionMethods) { this.mOfferedCompressionMethods = offeredCompressionMethods; } // Token: 0x06008FDF RID: 36831 RVA: 0x001FEB4C File Offset: 0x001FCD4C [Token(Token = "0x6008FDF")] [Address(RVA = "0x1E73020", Offset = "0x1E71A20", VA = "0x181E73020", 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: 0x06008FE0 RID: 36832 RVA: 0x001FEBD8 File Offset: 0x001FCDD8 [Token(Token = "0x6008FE0")] [Address(RVA = "0x1E72DD0", Offset = "0x1E717D0", VA = "0x181E72DD0", 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: 0x06008FE1 RID: 36833 RVA: 0x001FEC34 File Offset: 0x001FCE34 [Token(Token = "0x6008FE1")] [Address(RVA = "0x1E72850", Offset = "0x1E71250", VA = "0x181E72850", 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: 0x06008FE2 RID: 36834 RVA: 0x001FEC8C File Offset: 0x001FCE8C [Token(Token = "0x6008FE2")] [Address(RVA = "0x1E72A60", Offset = "0x1E71460", VA = "0x181E72A60", 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: 0x06008FE3 RID: 36835 RVA: 0x001FECD0 File Offset: 0x001FCED0 [Token(Token = "0x6008FE3")] [Address(RVA = "0x1E72BA0", Offset = "0x1E715A0", VA = "0x181E72BA0", 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: 0x06008FE4 RID: 36836 RVA: 0x001FED94 File Offset: 0x001FCF94 [Token(Token = "0x6008FE4")] [Address(RVA = "0x3F8880", Offset = "0x3F7280", VA = "0x1803F8880", Slot = "55")] public virtual IList GetServerSupplementalData() { } // Token: 0x06008FE5 RID: 36837 [Token(Token = "0x6008FE5")] [Address(Slot = "56")] public abstract TlsCredentials GetCredentials(); // Token: 0x06008FE6 RID: 36838 RVA: 0x001FEDA4 File Offset: 0x001FCFA4 [Token(Token = "0x6008FE6")] [Address(RVA = "0x3F8880", Offset = "0x3F7280", VA = "0x1803F8880", Slot = "57")] public virtual CertificateStatus GetCertificateStatus() { } // Token: 0x06008FE7 RID: 36839 [Token(Token = "0x6008FE7")] [Address(Slot = "58")] public abstract TlsKeyExchange GetKeyExchange(); // Token: 0x06008FE8 RID: 36840 RVA: 0x001FEDB4 File Offset: 0x001FCFB4 [Token(Token = "0x6008FE8")] [Address(RVA = "0x3F8880", Offset = "0x3F7280", VA = "0x1803F8880", Slot = "59")] public virtual CertificateRequest GetCertificateRequest() { } // Token: 0x06008FE9 RID: 36841 RVA: 0x001FEDC4 File Offset: 0x001FCFC4 [Token(Token = "0x6008FE9")] [Address(RVA = "0x1E731A0", Offset = "0x1E71BA0", VA = "0x181E731A0", Slot = "60")] public virtual void ProcessClientSupplementalData(IList clientSupplementalData) { while (clientSupplementalData != 0) { } } // Token: 0x06008FEA RID: 36842 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x6008FEA")] [Address(RVA = "0x1E72EC0", Offset = "0x1E718C0", VA = "0x181E72EC0", Slot = "61")] public virtual void NotifyClientCertificate(Certificate clientCertificate) { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x06008FEB RID: 36843 RVA: 0x001FEDD8 File Offset: 0x001FCFD8 [Token(Token = "0x6008FEB")] [Address(RVA = "0x1E72740", Offset = "0x1E71140", VA = "0x181E72740", Slot = "15")] public override TlsCompression GetCompression() { /* An exception occurred when decompiling this method (06008FEB) 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 1663 */; } // Token: 0x06008FEC RID: 36844 RVA: 0x001FEDEC File Offset: 0x001FCFEC [Token(Token = "0x6008FEC")] [Address(RVA = "0x1E725F0", Offset = "0x1E70FF0", VA = "0x181E725F0", Slot = "16")] public override TlsCipher GetCipher() { int encryptionAlgorithm = TlsUtilities.GetEncryptionAlgorithm(this.mSelectedCipherSuite); int num = TlsUtilities.GetMacAlgorithm(this.mSelectedCipherSuite); TlsCipherFactory tlsCipherFactory = this.mCipherFactory; TlsServerContext tlsServerContext = this.mContext; int num2 = 0; num2 += num2; num2++; tlsServerContext += tlsServerContext; num += 19; throw new NullReferenceException(); } // Token: 0x06008FED RID: 36845 RVA: 0x001FEE40 File Offset: 0x001FD040 [Token(Token = "0x6008FED")] [Address(RVA = "0x1E727C0", Offset = "0x1E711C0", VA = "0x181E727C0", Slot = "62")] public virtual NewSessionTicket GetNewSessionTicket() { byte[] emptyBytes = TlsUtilities.EmptyBytes; int num; NewSessionTicket newSessionTicket = new NewSessionTicket((long)num, emptyBytes); num = 0; return newSessionTicket; } // Token: 0x04005E7F RID: 24191 [global::Cpp2IlInjected.FieldOffset(Offset = "0x10")] [Token(Token = "0x4005E7F")] protected TlsCipherFactory mCipherFactory; // Token: 0x04005E80 RID: 24192 [global::Cpp2IlInjected.FieldOffset(Offset = "0x18")] [Token(Token = "0x4005E80")] protected TlsServerContext mContext; // Token: 0x04005E81 RID: 24193 [global::Cpp2IlInjected.FieldOffset(Offset = "0x20")] [Token(Token = "0x4005E81")] protected ProtocolVersion mClientVersion; // Token: 0x04005E82 RID: 24194 [global::Cpp2IlInjected.FieldOffset(Offset = "0x28")] [Token(Token = "0x4005E82")] protected int[] mOfferedCipherSuites; // Token: 0x04005E83 RID: 24195 [global::Cpp2IlInjected.FieldOffset(Offset = "0x30")] [Token(Token = "0x4005E83")] protected byte[] mOfferedCompressionMethods; // Token: 0x04005E84 RID: 24196 [global::Cpp2IlInjected.FieldOffset(Offset = "0x38")] [Token(Token = "0x4005E84")] protected IDictionary mClientExtensions; // Token: 0x04005E85 RID: 24197 [global::Cpp2IlInjected.FieldOffset(Offset = "0x40")] [Token(Token = "0x4005E85")] protected bool mEncryptThenMacOffered; // Token: 0x04005E86 RID: 24198 [global::Cpp2IlInjected.FieldOffset(Offset = "0x42")] [Token(Token = "0x4005E86")] protected short mMaxFragmentLengthOffered; // Token: 0x04005E87 RID: 24199 [global::Cpp2IlInjected.FieldOffset(Offset = "0x44")] [Token(Token = "0x4005E87")] protected bool mTruncatedHMacOffered; // Token: 0x04005E88 RID: 24200 [global::Cpp2IlInjected.FieldOffset(Offset = "0x48")] [Token(Token = "0x4005E88")] protected IList mSupportedSignatureAlgorithms; // Token: 0x04005E89 RID: 24201 [global::Cpp2IlInjected.FieldOffset(Offset = "0x50")] [Token(Token = "0x4005E89")] protected bool mEccCipherSuitesOffered; // Token: 0x04005E8A RID: 24202 [global::Cpp2IlInjected.FieldOffset(Offset = "0x58")] [Token(Token = "0x4005E8A")] protected int[] mNamedCurves; // Token: 0x04005E8B RID: 24203 [global::Cpp2IlInjected.FieldOffset(Offset = "0x60")] [Token(Token = "0x4005E8B")] protected byte[] mClientECPointFormats; // Token: 0x04005E8C RID: 24204 [global::Cpp2IlInjected.FieldOffset(Offset = "0x68")] [Token(Token = "0x4005E8C")] protected byte[] mServerECPointFormats; // Token: 0x04005E8D RID: 24205 [global::Cpp2IlInjected.FieldOffset(Offset = "0x70")] [Token(Token = "0x4005E8D")] protected ProtocolVersion mServerVersion; // Token: 0x04005E8E RID: 24206 [global::Cpp2IlInjected.FieldOffset(Offset = "0x78")] [Token(Token = "0x4005E8E")] protected int mSelectedCipherSuite; // Token: 0x04005E8F RID: 24207 [global::Cpp2IlInjected.FieldOffset(Offset = "0x7C")] [Token(Token = "0x4005E8F")] protected byte mSelectedCompressionMethod; // Token: 0x04005E90 RID: 24208 [global::Cpp2IlInjected.FieldOffset(Offset = "0x80")] [Token(Token = "0x4005E90")] protected IDictionary mServerExtensions; } }