terraria-cpp2il-methodrecon v1.4.4.9
Terraria mobile dump, with reconstructed method body. Dump with CallAnalysis: https://infinitynichto.github.io/terraria-cpp2il
Loading...
Searching...
No Matches
ChainValidationHelper.cs
Go to the documentation of this file.
1using System;
2using System.Net;
10
11namespace Mono.Net.Security
12{
13 // Token: 0x02000055 RID: 85
15 {
16 // Token: 0x060000E5 RID: 229 RVA: 0x000041E0 File Offset: 0x000023E0
18 {
19 while (provider == null)
20 {
21 }
22 throw new InvalidCastException();
23 }
24
25 // Token: 0x060000E6 RID: 230 RVA: 0x00002050 File Offset: 0x00000250
27 {
28 throw new global::Cpp2IlInjected.AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
29 }
30
31 // Token: 0x060000E7 RID: 231 RVA: 0x000041F8 File Offset: 0x000023F8
32 private ChainValidationHelper(global::System.Net.Security.SslStream owner, MobileTlsProvider provider, MonoTlsSettings settings, bool cloneSettings, MonoTlsStream stream)
33 {
36 if (settings != null)
37 {
38 if (provider == null)
39 {
40 return;
41 }
42 }
43 else
44 {
46 if (provider == null)
47 {
49 }
50 }
53 this.tlsStream = stream;
54 if (owner != null)
55 {
56 }
57 if (monoTlsSettings != null)
58 {
59 global::System.Net.ServerCertValidationCallback validationCallback = ChainValidationHelper.GetValidationCallback(monoTlsSettings);
60 this.certValidationCallback = validationCallback;
61 global::System.Net.Security.LocalCertSelectionCallback localCertSelectionCallback = Mono.Net.Security.Private.CallbackHelpers.MonoToInternal(monoTlsSettings.<ClientCertificateSelectionCallback>k__BackingField);
63 if (stream == null)
64 {
65 if (owner == null)
66 {
67 return;
68 }
69 goto IL_00A0;
70 }
71 }
72 else
73 {
74 while (stream == null)
75 {
76 }
77 }
78 global::System.Net.HttpWebRequest httpWebRequest = stream.request;
79 global::System.Net.ServerCertValidationCallback serverCertValidationCallback = this.certValidationCallback;
82 {
83 global::System.Net.ServerCertValidationCallback serverCertValidationCallback2 = httpWebRequest.certValidationCallback;
84 }
85 if (this.certSelectionCallback == null)
86 {
87 }
88 IL_00A0:
89 global::System.Net.ServerCertValidationCallback serverCertValidationCallback3 = this.certValidationCallback;
91 {
93 {
94 }
95 if (!true)
96 {
97 }
99 }
100 }
101
102 // Token: 0x060000E8 RID: 232 RVA: 0x000042C0 File Offset: 0x000024C0
103 private static global::System.Net.ServerCertValidationCallback GetValidationCallback(MonoTlsSettings settings)
104 {
105 if (true)
106 {
107 return;
108 }
109 }
110
111 // Token: 0x060000E9 RID: 233 RVA: 0x000042D4 File Offset: 0x000024D4
112 private static X509Certificate DefaultSelectionCallback(string targetHost, global::System.Security.Cryptography.X509Certificates.X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers)
113 {
114 int num;
115 if (targetHost != null && num != 0)
116 {
117 X509Certificate x509Certificate;
118 return x509Certificate;
119 }
120 }
121
122 // Token: 0x17000022 RID: 34
123 // (get) Token: 0x060000EA RID: 234 RVA: 0x000042EC File Offset: 0x000024EC
125 {
126 get
127 {
128 return this.settings;
129 }
130 }
131
132 // Token: 0x060000EB RID: 235 RVA: 0x00004300 File Offset: 0x00002500
133 public bool SelectClientCertificate(string targetHost, global::System.Security.Cryptography.X509Certificates.X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers, [Out] X509Certificate clientCertificate)
134 {
135 global::System.Net.Security.LocalCertSelectionCallback localCertSelectionCallback = this.certSelectionCallback;
136 if (localCertSelectionCallback != null)
137 {
138 IntPtr invoke_impl = localCertSelectionCallback.invoke_impl;
139 IntPtr method_code = localCertSelectionCallback.method_code;
140 IntPtr method = localCertSelectionCallback.method;
141 }
142 return true;
143 }
144
145 // Token: 0x060000EC RID: 236 RVA: 0x00004330 File Offset: 0x00002530
146 public ValidationResult ValidateCertificate(string host, bool serverMode, X509Certificate leaf, global::System.Security.Cryptography.X509Certificates.X509Chain chain)
147 {
148 MonoTlsStream monoTlsStream = this.tlsStream;
150 if (monoTlsStream != null)
151 {
152 if (validationResult != null && validationResult.trusted)
153 {
154 bool user_denied = validationResult.user_denied;
155 return validationResult;
156 }
157 int num = 1;
158 monoTlsStream.<CertificateValidationFailed>k__BackingField = num != 0;
159 }
160 return validationResult;
161 }
162
163 // Token: 0x060000ED RID: 237 RVA: 0x00004388 File Offset: 0x00002588
164 private ValidationResult ValidateChain(string host, bool server, X509Certificate leaf, global::System.Security.Cryptography.X509Certificates.X509Chain chain, global::System.Security.Cryptography.X509Certificates.X509CertificateCollection certs, global::System.Net.Security.SslPolicyErrors errors)
165 {
166 ValidationResult validationResult = this.ValidateChain(host, server, leaf, chain, certs, errors);
167 long num = 0L;
168 long num2;
169 if (validationResult != null)
170 {
171 if (num != 0L)
172 {
173 return validationResult;
174 }
175 }
176 else if (num2 != 0L)
177 {
178 throw new OutOfMemoryException();
179 }
180 return validationResult;
181 }
182
183 // Token: 0x060000EE RID: 238 RVA: 0x000043E8 File Offset: 0x000025E8
184 private ValidationResult ValidateChain(string host, bool server, X509Certificate leaf, global::System.Security.Cryptography.X509Certificates.X509Chain chain, global::System.Security.Cryptography.X509Certificates.X509CertificateCollection certs, global::System.Net.Security.SslPolicyErrors errors)
185 {
186 MonoTlsStream monoTlsStream = this.tlsStream;
187 if (monoTlsStream != null)
188 {
189 this.request.ServicePoint.UpdateServerCertificate(leaf);
190 }
191 if (leaf != null)
192 {
193 bool flag = string.IsNullOrEmpty(host);
194 int num = 58;
195 int num2 = host.IndexOf((char)num);
196 long num3 = 0L;
197 string text = host.Substring((int)num3, num2);
198 if (monoTlsStream == null)
199 {
200 }
201 int num4 = 1;
202 if (num4 == 0)
203 {
204 }
205 if (num4 == 0)
206 {
207 }
208 if (this.certValidationCallback == null)
209 {
210 goto IL_0071;
211 }
213 if (monoTlsSettings != null && !monoTlsSettings.callbackNeedsChain)
214 {
215 goto IL_0071;
216 }
217 }
218 if (this.certValidationCallback == null)
219 {
220 return 1;
221 }
222 IL_0071:
223 if (certs != null || leaf != null)
224 {
225 }
226 bool flag2;
227 if (!flag2)
228 {
229 return 1;
230 }
231 return 1;
232 }
233
234 // Token: 0x060000EF RID: 239 RVA: 0x00004478 File Offset: 0x00002678
235 private bool InvokeCallback(X509Certificate leaf, global::System.Security.Cryptography.X509Certificates.X509Chain chain, global::System.Net.Security.SslPolicyErrors errors)
236 {
237 long num;
238 if (this.request == null)
239 {
240 if (this.owner != null)
241 {
242 bool flag;
243 return flag;
244 }
245 num = 0L;
246 }
247 return this.certValidationCallback.Invoke(num, leaf, chain, errors);
248 }
249
250 // Token: 0x040000C5 RID: 197
251 private readonly WeakReference<global::System.Net.Security.SslStream> owner;
252
253 // Token: 0x040000C6 RID: 198
255
256 // Token: 0x040000C7 RID: 199
258
259 // Token: 0x040000C8 RID: 200
260 private readonly global::System.Net.ServerCertValidationCallback certValidationCallback;
261
262 // Token: 0x040000C9 RID: 201
263 private readonly global::System.Net.Security.LocalCertSelectionCallback certSelectionCallback;
264
265 // Token: 0x040000CA RID: 202
267
268 // Token: 0x040000CB RID: 203
269 private readonly global::System.Net.HttpWebRequest request;
270
271 // Token: 0x02000056 RID: 86
273 private sealed class <>c__DisplayClass11_0
274 {
275 // Token: 0x060000F0 RID: 240 RVA: 0x000044A8 File Offset: 0x000026A8
277 {
278 }
279
280 // Token: 0x060000F1 RID: 241 RVA: 0x000044BC File Offset: 0x000026BC
281 internal bool <GetValidationCallback>b__0(object s, X509Certificate c, global::System.Security.Cryptography.X509Certificates.X509Chain ch, global::System.Net.Security.SslPolicyErrors e)
282 {
283 /*
284An exception occurred when decompiling this method (060000F1)
285
286ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean Mono.Net.Security.ChainValidationHelper/<>c__DisplayClass11_0::<GetValidationCallback>b__0(System.Object,System.Security.Cryptography.X509Certificates.X509Certificate,System.Security.Cryptography.X509Certificates.X509Chain,System.Net.Security.SslPolicyErrors)
287
288 ---> System.Exception: Basic block has to end with unconditional control flow.
289{
290 IL_0029:
291 stloc:MonoRemoteCertificateValidationCallback(var_8_34, ldfld:MonoRemoteCertificateValidationCallback(MonoTlsSettings::<RemoteCertificateValidationCallback>k__BackingField, ldfld:MonoTlsSettings('<>c__DisplayClass11_0'::settings, ldloc:'<>c__DisplayClass11_0'(this))))
292 stloc:native int(var_9_3D, ldfld:native int(Delegate::invoke_impl, ldloc:MonoRemoteCertificateValidationCallback[exp:Delegate](var_8_34)))
293 stloc:native int(var_10_46, ldfld:native int(Delegate::method_code, ldloc:MonoRemoteCertificateValidationCallback[exp:Delegate](var_8_34)))
294 stloc:native int(var_11_4F, ldfld:native int(Delegate::method, ldloc:MonoRemoteCertificateValidationCallback[exp:Delegate](var_8_34)))
295}
296
297 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
298 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
299 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
300 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
301 --- End of inner exception stack trace ---
302 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
303 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 1683
304*/;
305 }
306
307 // Token: 0x040000CC RID: 204
309 }
310 }
311}
class f__AnonymousType0<< Count > j__TPar
ChainValidationHelper(global::System.Net.Security.SslStream owner, MobileTlsProvider provider, MonoTlsSettings settings, bool cloneSettings, MonoTlsStream stream)
readonly global::System.Net.Security.LocalCertSelectionCallback certSelectionCallback
readonly WeakReference< global::System.Net.Security.SslStream > owner
readonly global::System.Net.HttpWebRequest request
static ChainValidationHelper Create(MobileTlsProvider provider, MonoTlsSettings settings, MonoTlsStream stream)
readonly global::System.Net.ServerCertValidationCallback certValidationCallback
static ChainValidationHelper GetInternalValidator(global::System.Net.Security.SslStream owner, MobileTlsProvider provider, MonoTlsSettings settings)
bool InvokeCallback(X509Certificate leaf, global::System.Security.Cryptography.X509Certificates.X509Chain chain, global::System.Net.Security.SslPolicyErrors errors)
bool SelectClientCertificate(string targetHost, global::System.Security.Cryptography.X509Certificates.X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers, [Out] X509Certificate clientCertificate)
static X509Certificate DefaultSelectionCallback(string targetHost, global::System.Security.Cryptography.X509Certificates.X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] acceptableIssuers)
ValidationResult ValidateChain(string host, bool server, X509Certificate leaf, global::System.Security.Cryptography.X509Certificates.X509Chain chain, global::System.Security.Cryptography.X509Certificates.X509CertificateCollection certs, global::System.Net.Security.SslPolicyErrors errors)
ValidationResult ValidateCertificate(string host, bool serverMode, X509Certificate leaf, global::System.Security.Cryptography.X509Certificates.X509Chain chain)
static global::System.Net.ServerCertValidationCallback GetValidationCallback(MonoTlsSettings settings)
readonly global::System.Net.HttpWebRequest request
static global::System.Net.Security.LocalCertSelectionCallback MonoToInternal(MonoLocalCertificateSelectionCallback callback)
MonoTlsSettings CloneWithValidator(ICertificateValidator validator)
static MonoTlsSettings CopyDefaultSettings()