using System; using System.Collections; using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls { // Token: 0x02001BD8 RID: 7128 [Token(Token = "0x2001BD8")] public abstract class AbstractTlsServer : AbstractTlsPeer, TlsServer, TlsPeer { // Token: 0x0600AF78 RID: 44920 RVA: 0x0025F134 File Offset: 0x0025D334 [Token(Token = "0x600AF78")] [Address(RVA = "0x232D6D0", Offset = "0x232C6D0", VA = "0x18232D6D0")] public AbstractTlsServer() { DefaultTlsCipherFactory defaultTlsCipherFactory = new DefaultTlsCipherFactory(); base..ctor(); this.mCipherFactory = defaultTlsCipherFactory; } // Token: 0x0600AF79 RID: 44921 RVA: 0x0025F154 File Offset: 0x0025D354 [Token(Token = "0x600AF79")] [Address(RVA = "0x493D90", Offset = "0x492D90", VA = "0x180493D90")] public AbstractTlsServer(TlsCipherFactory cipherFactory) { this.mCipherFactory = cipherFactory; } // Token: 0x17001BDD RID: 7133 // (get) Token: 0x0600AF7A RID: 44922 RVA: 0x0025F170 File Offset: 0x0025D370 [Token(Token = "0x17001BDD")] protected virtual bool AllowEncryptThenMac { [Token(Token = "0x600AF7A")] [Address(RVA = "0x4246A0", Offset = "0x4236A0", VA = "0x1804246A0", Slot = "38")] get { return true; } } // Token: 0x17001BDE RID: 7134 // (get) Token: 0x0600AF7B RID: 44923 RVA: 0x0025F180 File Offset: 0x0025D380 [Token(Token = "0x17001BDE")] protected virtual bool AllowTruncatedHMac { [Token(Token = "0x600AF7B")] [Address(RVA = "0x424690", Offset = "0x423690", VA = "0x180424690", Slot = "39")] get { } } // Token: 0x0600AF7C RID: 44924 RVA: 0x0025F190 File Offset: 0x0025D390 [Token(Token = "0x600AF7C")] [Address(RVA = "0x232CA00", Offset = "0x232BA00", VA = "0x18232CA00", Slot = "40")] protected virtual IDictionary CheckServerExtensions() { IDictionary dictionary = TlsExtensionsUtilities.EnsureExtensionsInitialised(this.mServerExtensions); this.mServerExtensions = dictionary; return dictionary; } // Token: 0x0600AF7D RID: 44925 [Token(Token = "0x600AF7D")] [Address(Slot = "41")] protected abstract int[] GetCipherSuites(); // Token: 0x0600AF7E RID: 44926 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x600AF7E")] [Address(RVA = "0x232CAD0", Offset = "0x232BAD0", VA = "0x18232CAD0")] protected byte[] GetCompressionMethods() { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x17001BDF RID: 7135 // (get) Token: 0x0600AF7F RID: 44927 RVA: 0x0025F1B4 File Offset: 0x0025D3B4 [Token(Token = "0x17001BDF")] protected virtual ProtocolVersion MaximumVersion { [Token(Token = "0x600AF7F")] [Address(RVA = "0x232D730", Offset = "0x232C730", VA = "0x18232D730", Slot = "42")] get { return ProtocolVersion.TLSv11; } } // Token: 0x17001BE0 RID: 7136 // (get) Token: 0x0600AF80 RID: 44928 RVA: 0x0025F1C8 File Offset: 0x0025D3C8 [Token(Token = "0x17001BE0")] protected virtual ProtocolVersion MinimumVersion { [Token(Token = "0x600AF80")] [Address(RVA = "0x232D790", Offset = "0x232C790", VA = "0x18232D790", Slot = "43")] get { return ProtocolVersion.TLSv10; } } // Token: 0x0600AF81 RID: 44929 RVA: 0x0025F1DC File Offset: 0x0025D3DC [Token(Token = "0x600AF81")] [Address(RVA = "0x232D5D0", Offset = "0x232C5D0", VA = "0x18232D5D0", 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: 0x0600AF82 RID: 44930 RVA: 0x0025F234 File Offset: 0x0025D434 [Token(Token = "0x600AF82")] [Address(RVA = "0x4157F0", Offset = "0x4147F0", VA = "0x1804157F0", Slot = "45")] public virtual void Init(TlsServerContext context) { this.mContext = context; } // Token: 0x0600AF83 RID: 44931 RVA: 0x0025F248 File Offset: 0x0025D448 [Token(Token = "0x600AF83")] [Address(RVA = "0x415810", Offset = "0x414810", VA = "0x180415810", Slot = "46")] public virtual void NotifyClientVersion(ProtocolVersion clientVersion) { this.mClientVersion = clientVersion; } // Token: 0x0600AF84 RID: 44932 RVA: 0x0025F25C File Offset: 0x0025D45C [Token(Token = "0x600AF84")] [Address(RVA = "0x232D2E0", Offset = "0x232C2E0", VA = "0x18232D2E0", Slot = "47")] public virtual void NotifyFallback(bool isFallback) { while (isFallback) { int[] cipherSuites = this.GetCipherSuites(); ProtocolVersion protocolVersion = this.mClientVersion; bool flag; if (!flag) { break; } } } // Token: 0x0600AF85 RID: 44933 RVA: 0x0025F280 File Offset: 0x0025D480 [Token(Token = "0x600AF85")] [Address(RVA = "0x232D380", Offset = "0x232C380", VA = "0x18232D380", Slot = "48")] public virtual void NotifyOfferedCipherSuites(int[] offeredCipherSuites) { this.mOfferedCipherSuites = offeredCipherSuites; bool flag = TlsEccUtilities.ContainsEccCipherSuites(offeredCipherSuites); this.mEccCipherSuitesOffered = flag; } // Token: 0x0600AF86 RID: 44934 RVA: 0x0025F2A4 File Offset: 0x0025D4A4 [Token(Token = "0x600AF86")] [Address(RVA = "0x415830", Offset = "0x414830", VA = "0x180415830", Slot = "49")] public virtual void NotifyOfferedCompressionMethods(byte[] offeredCompressionMethods) { this.mOfferedCompressionMethods = offeredCompressionMethods; } // Token: 0x0600AF87 RID: 44935 RVA: 0x0025F2B8 File Offset: 0x0025D4B8 [Token(Token = "0x600AF87")] [Address(RVA = "0x232D3F0", Offset = "0x232C3F0", VA = "0x18232D3F0", 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: 0x0600AF88 RID: 44936 RVA: 0x0025F344 File Offset: 0x0025D544 [Token(Token = "0x600AF88")] [Address(RVA = "0x232D1A0", Offset = "0x232C1A0", VA = "0x18232D1A0", 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: 0x0600AF89 RID: 44937 RVA: 0x0025F3A0 File Offset: 0x0025D5A0 [Token(Token = "0x600AF89")] [Address(RVA = "0x232CC20", Offset = "0x232BC20", VA = "0x18232CC20", 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: 0x0600AF8A RID: 44938 RVA: 0x0025F3F8 File Offset: 0x0025D5F8 [Token(Token = "0x600AF8A")] [Address(RVA = "0x232CE30", Offset = "0x232BE30", VA = "0x18232CE30", 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: 0x0600AF8B RID: 44939 RVA: 0x0025F43C File Offset: 0x0025D63C [Token(Token = "0x600AF8B")] [Address(RVA = "0x232CF70", Offset = "0x232BF70", VA = "0x18232CF70", 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: 0x0600AF8C RID: 44940 RVA: 0x0025F500 File Offset: 0x0025D700 [Token(Token = "0x600AF8C")] [Address(RVA = "0x4242C0", Offset = "0x4232C0", VA = "0x1804242C0", Slot = "55")] public virtual IList GetServerSupplementalData() { } // Token: 0x0600AF8D RID: 44941 [Token(Token = "0x600AF8D")] [Address(Slot = "56")] public abstract TlsCredentials GetCredentials(); // Token: 0x0600AF8E RID: 44942 RVA: 0x0025F510 File Offset: 0x0025D710 [Token(Token = "0x600AF8E")] [Address(RVA = "0x4242C0", Offset = "0x4232C0", VA = "0x1804242C0", Slot = "57")] public virtual CertificateStatus GetCertificateStatus() { } // Token: 0x0600AF8F RID: 44943 [Token(Token = "0x600AF8F")] [Address(Slot = "58")] public abstract TlsKeyExchange GetKeyExchange(); // Token: 0x0600AF90 RID: 44944 RVA: 0x0025F520 File Offset: 0x0025D720 [Token(Token = "0x600AF90")] [Address(RVA = "0x4242C0", Offset = "0x4232C0", VA = "0x1804242C0", Slot = "59")] public virtual CertificateRequest GetCertificateRequest() { } // Token: 0x0600AF91 RID: 44945 RVA: 0x0025F530 File Offset: 0x0025D730 [Token(Token = "0x600AF91")] [Address(RVA = "0x232D570", Offset = "0x232C570", VA = "0x18232D570", Slot = "60")] public virtual void ProcessClientSupplementalData(IList clientSupplementalData) { while (clientSupplementalData != 0) { } } // Token: 0x0600AF92 RID: 44946 RVA: 0x0000220F File Offset: 0x0000040F [Token(Token = "0x600AF92")] [Address(RVA = "0x232D290", Offset = "0x232C290", VA = "0x18232D290", Slot = "61")] public virtual void NotifyClientCertificate(Certificate clientCertificate) { throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method."); } // Token: 0x0600AF93 RID: 44947 RVA: 0x0025F544 File Offset: 0x0025D744 [Token(Token = "0x600AF93")] [Address(RVA = "0x232CB10", Offset = "0x232BB10", VA = "0x18232CB10", Slot = "15")] public override TlsCompression GetCompression() { /* An exception occurred when decompiling this method (0600AF93) 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: 0x0600AF94 RID: 44948 RVA: 0x0025F558 File Offset: 0x0025D758 [Token(Token = "0x600AF94")] [Address(RVA = "0x232CA30", Offset = "0x232BA30", VA = "0x18232CA30", 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: 0x0600AF95 RID: 44949 RVA: 0x0025F590 File Offset: 0x0025D790 [Token(Token = "0x600AF95")] [Address(RVA = "0x232CB90", Offset = "0x232BB90", VA = "0x18232CB90", Slot = "62")] public virtual NewSessionTicket GetNewSessionTicket() { byte[] emptyBytes = TlsUtilities.EmptyBytes; int num; NewSessionTicket newSessionTicket = new NewSessionTicket((long)num, emptyBytes); num = 0; return newSessionTicket; } // Token: 0x04006E7B RID: 28283 [FieldOffset(Offset = "0x10")] [Token(Token = "0x4006E7B")] protected TlsCipherFactory mCipherFactory; // Token: 0x04006E7C RID: 28284 [FieldOffset(Offset = "0x18")] [Token(Token = "0x4006E7C")] protected TlsServerContext mContext; // Token: 0x04006E7D RID: 28285 [FieldOffset(Offset = "0x20")] [Token(Token = "0x4006E7D")] protected ProtocolVersion mClientVersion; // Token: 0x04006E7E RID: 28286 [FieldOffset(Offset = "0x28")] [Token(Token = "0x4006E7E")] protected int[] mOfferedCipherSuites; // Token: 0x04006E7F RID: 28287 [FieldOffset(Offset = "0x30")] [Token(Token = "0x4006E7F")] protected byte[] mOfferedCompressionMethods; // Token: 0x04006E80 RID: 28288 [FieldOffset(Offset = "0x38")] [Token(Token = "0x4006E80")] protected IDictionary mClientExtensions; // Token: 0x04006E81 RID: 28289 [FieldOffset(Offset = "0x40")] [Token(Token = "0x4006E81")] protected bool mEncryptThenMacOffered; // Token: 0x04006E82 RID: 28290 [FieldOffset(Offset = "0x42")] [Token(Token = "0x4006E82")] protected short mMaxFragmentLengthOffered; // Token: 0x04006E83 RID: 28291 [FieldOffset(Offset = "0x44")] [Token(Token = "0x4006E83")] protected bool mTruncatedHMacOffered; // Token: 0x04006E84 RID: 28292 [FieldOffset(Offset = "0x48")] [Token(Token = "0x4006E84")] protected IList mSupportedSignatureAlgorithms; // Token: 0x04006E85 RID: 28293 [FieldOffset(Offset = "0x50")] [Token(Token = "0x4006E85")] protected bool mEccCipherSuitesOffered; // Token: 0x04006E86 RID: 28294 [FieldOffset(Offset = "0x58")] [Token(Token = "0x4006E86")] protected int[] mNamedCurves; // Token: 0x04006E87 RID: 28295 [FieldOffset(Offset = "0x60")] [Token(Token = "0x4006E87")] protected byte[] mClientECPointFormats; // Token: 0x04006E88 RID: 28296 [FieldOffset(Offset = "0x68")] [Token(Token = "0x4006E88")] protected byte[] mServerECPointFormats; // Token: 0x04006E89 RID: 28297 [FieldOffset(Offset = "0x70")] [Token(Token = "0x4006E89")] protected ProtocolVersion mServerVersion; // Token: 0x04006E8A RID: 28298 [FieldOffset(Offset = "0x78")] [Token(Token = "0x4006E8A")] protected int mSelectedCipherSuite; // Token: 0x04006E8B RID: 28299 [FieldOffset(Offset = "0x7C")] [Token(Token = "0x4006E8B")] protected byte mSelectedCompressionMethod; // Token: 0x04006E8C RID: 28300 [FieldOffset(Offset = "0x80")] [Token(Token = "0x4006E8C")] protected IDictionary mServerExtensions; } }