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
DSAManaged.cs
Go to the documentation of this file.
1using System;
4using Mono.Math;
5
7{
8 // Token: 0x0200004D RID: 77
9 internal class DSAManaged : DSA
10 {
11 // Token: 0x060001A5 RID: 421 RVA: 0x000067D4 File Offset: 0x000049D4
13 {
15 }
16
17 // Token: 0x060001A6 RID: 422 RVA: 0x000067F4 File Offset: 0x000049F4
18 protected override void Finalize()
19 {
20 base.Finalize();
21 }
22
23 // Token: 0x060001A7 RID: 423 RVA: 0x00006828 File Offset: 0x00004A28
24 private void Generate()
25 {
26 int keySizeValue = this.KeySizeValue;
27 this.GenerateParams(keySizeValue);
28 this.GenerateKeyPair();
31 if (keyGenerated != null)
32 {
33 IntPtr invoke_impl = keyGenerated.invoke_impl;
34 IntPtr method_code = keyGenerated.method_code;
35 IntPtr method = keyGenerated.method;
36 return;
37 }
38 }
39
40 // Token: 0x060001A8 RID: 424 RVA: 0x00006874 File Offset: 0x00004A74
41 private void GenerateKeyPair()
42 {
43 if (!true)
44 {
45 }
48 if (!true)
49 {
50 }
51 long num = 0L;
52 bool flag = bigInteger == (uint)num;
55 if (!true)
56 {
57 }
59 this.x.Randomize();
61 }
62
63 // Token: 0x060001A9 RID: 425 RVA: 0x00006900 File Offset: 0x00004B00
64 private void add(byte[] a, byte[] b, int value)
65 {
66 }
67
68 // Token: 0x060001AA RID: 426 RVA: 0x00006910 File Offset: 0x00004B10
69 private void GenerateParams(int keyLength)
70 {
71 SHA1 sha = SHA1.Create();
72 if (this.rng == null)
73 {
76 }
77 byte[] array2;
78 byte[] array = sha.ComputeHash(array2);
79 }
80
81 // Token: 0x1700002D RID: 45
82 // (get) Token: 0x060001AB RID: 427 RVA: 0x00006A8C File Offset: 0x00004C8C
84 {
85 get
86 {
88 if (this.rng == null)
89 {
90 randomNumberGenerator = RandomNumberGenerator.Create();
92 }
94 }
95 }
96
97 // Token: 0x1700002E RID: 46
98 // (get) Token: 0x060001AC RID: 428 RVA: 0x00006AB0 File Offset: 0x00004CB0
99 public override int KeySize
100 {
101 get
102 {
103 int num;
104 if (this.keypairGenerated)
105 {
106 num = this.p.BitCount();
107 return num;
108 }
109 return num;
110 }
111 }
112
113 // Token: 0x1700002F RID: 47
114 // (get) Token: 0x060001AD RID: 429 RVA: 0x00006AD4 File Offset: 0x00004CD4
115 public override string KeyExchangeAlgorithm
116 {
117 get
118 {
119 }
120 }
121
122 // Token: 0x17000030 RID: 48
123 // (get) Token: 0x060001AE RID: 430 RVA: 0x00006AE4 File Offset: 0x00004CE4
124 public bool PublicOnly
125 {
126 get
127 {
128 if (this.keypairGenerated)
129 {
130 BigInteger bigInteger = this.x;
131 bool flag;
132 return flag;
133 }
134 }
135 }
136
137 // Token: 0x17000031 RID: 49
138 // (get) Token: 0x060001AF RID: 431 RVA: 0x00006B04 File Offset: 0x00004D04
139 public override string SignatureAlgorithm
140 {
141 get
142 {
143 return "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
144 }
145 }
146
147 // Token: 0x060001B0 RID: 432 RVA: 0x00006B18 File Offset: 0x00004D18
148 private byte[] NormalizeArray(byte[] array)
149 {
150 }
151
152 // Token: 0x060001B1 RID: 433 RVA: 0x00006B28 File Offset: 0x00004D28
154 {
155 /*
156An exception occurred when decompiling this method (060001B1)
157
158ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Security.Cryptography.DSAParameters Mono.Security.Cryptography.DSAManaged::ExportParameters(System.Boolean)
159
160 ---> System.Exception: Basic block has to end with unconditional control flow.
161{
162 IL_00F7:
163 stloc:string(var_26_101, call:string(Locale::GetText, ldstr:string("Keypair was disposed")))
164}
165
166 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
167 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
168 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
169 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
170 --- End of inner exception stack trace ---
171 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
172 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
173*/;
174 }
175
176 // Token: 0x060001B2 RID: 434 RVA: 0x00006C38 File Offset: 0x00004E38
177 public override void ImportParameters(DSAParameters parameters)
178 {
179 if (!this.m_disposed)
180 {
181 if (parameters.Q == null || parameters.G == null)
182 {
183 string text = Locale.GetText("Missing mandatory DSA parameters (P, Q or G).");
184 return;
185 }
186 byte[] array;
187 if (parameters.X == null)
188 {
189 array = parameters.Y;
190 if (array == null)
191 {
192 return;
193 }
194 }
195 byte[] array2 = parameters.Q;
196 byte[] array3 = parameters.G;
197 if (parameters.X != null)
198 {
199 return;
200 }
201 if (parameters.Y != null)
202 {
203 return;
204 }
205 BigInteger bigInteger = this.g;
206 BigInteger bigInteger2 = this.p;
209 if (parameters.J != null)
210 {
211 return;
212 }
213 BigInteger bigInteger4 = this.p;
214 if (array == null)
215 {
216 }
219 BigInteger bigInteger7 = this.q;
221 this.j_missing = true;
222 this.j = array;
223 int num;
224 if (parameters.Seed != null)
225 {
226 num = parameters.Counter;
227 this.counter = num;
228 return;
229 }
230 if (num == 0)
231 {
232 }
236 return;
237 }
238 else
239 {
240 string text2 = Locale.GetText("Keypair was disposed");
241 }
242 }
243
244 // Token: 0x060001B3 RID: 435 RVA: 0x00006D48 File Offset: 0x00004F48
245 public override byte[] CreateSignature(byte[] rgbHash)
246 {
247 bool disposed = this.m_disposed;
248 if (!disposed)
249 {
250 if (rgbHash == null)
251 {
252 goto IL_00CB;
253 }
254 if (!disposed)
255 {
256 this.Generate();
257 }
258 BigInteger bigInteger = this.x;
259 if (!disposed)
260 {
261 }
262 if (!disposed)
263 {
264 }
266 BigInteger bigInteger3 = this.q;
267 if (!disposed)
268 {
269 }
272 BigInteger bigInteger4 = this.g;
273 BigInteger bigInteger5 = this.p;
275 BigInteger bigInteger7 = this.q;
276 BigInteger bigInteger8 = this.q;
283 byte[] bytes = bigInteger7.GetBytes();
284 }
285 string text = Locale.GetText("Keypair was disposed");
286 IL_00CB:
287 return "invalid hash length";
288 }
289
290 // Token: 0x060001B4 RID: 436 RVA: 0x00006E28 File Offset: 0x00005028
291 public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
292 {
293 if (!this.m_disposed)
294 {
295 if (rgbHash == null)
296 {
297 goto IL_00E1;
298 }
299 if (rgbSignature == null)
300 {
301 return "invalid hash length" != null;
302 }
303 if (this.keypairGenerated)
304 {
306 BigInteger bigInteger2 = this.q;
308 BigInteger bigInteger4 = this.q;
309 BigInteger bigInteger5 = this.q;
310 BigInteger bigInteger6 = this.q;
313 BigInteger bigInteger8 = this.q;
328 bool flag;
329 return flag;
330 }
331 }
332 string text = Locale.GetText("Keypair was disposed");
333 IL_00E1:
334 return "rgbHash" != null;
335 }
336
337 // Token: 0x060001B5 RID: 437 RVA: 0x00006FB4 File Offset: 0x000051B4
338 protected override void Dispose(bool disposing)
339 {
340 bool disposed = this.m_disposed;
341 if (!disposed)
342 {
343 BigInteger bigInteger = this.x;
344 if (!disposed)
345 {
346 }
347 BigInteger bigInteger2 = this.x;
348 if (bigInteger2.length != 0U)
349 {
350 uint[] data = bigInteger2.data;
351 uint length = bigInteger2.length;
352 }
353 BigInteger bigInteger3 = this.p;
354 if (bigInteger2 == null)
355 {
356 }
357 BigInteger bigInteger4 = this.p;
358 if (bigInteger4.length != 0U)
359 {
360 uint[] data2 = bigInteger4.data;
361 uint length2 = bigInteger4.length;
362 }
363 BigInteger bigInteger5 = this.q;
364 if (bigInteger4 == null)
365 {
366 }
367 BigInteger bigInteger6 = this.q;
368 if (bigInteger6.length != 0U)
369 {
370 uint[] data3 = bigInteger6.data;
371 uint length3 = bigInteger6.length;
372 }
373 BigInteger bigInteger7 = this.g;
374 if (bigInteger6 == null)
375 {
376 }
377 BigInteger bigInteger8 = this.g;
378 if (bigInteger8.length != 0U)
379 {
380 uint[] data4 = bigInteger8.data;
381 uint length4 = bigInteger8.length;
382 }
383 BigInteger bigInteger9 = this.j;
384 if (bigInteger8 == null)
385 {
386 }
388 if (bigInteger10.length != 0U)
389 {
390 uint[] data5 = bigInteger10.data;
391 uint length5 = bigInteger10.length;
392 }
394 if (bigInteger10 == null)
395 {
396 }
398 if (bigInteger12.length != 0U)
399 {
400 uint[] data6 = bigInteger12.data;
401 uint length6 = bigInteger12.length;
402 }
404 if (bigInteger12 == null)
405 {
406 }
408 if (bigInteger14.length != 0U)
409 {
410 uint[] data7 = bigInteger14.data;
411 uint length7 = bigInteger14.length;
412 }
413 }
414 int num = 1;
415 this.m_disposed = num != 0;
416 }
417
418 // Token: 0x14000002 RID: 2
419 // (add) Token: 0x060001B6 RID: 438 RVA: 0x00007130 File Offset: 0x00005330
420 // (remove) Token: 0x060001B7 RID: 439 RVA: 0x00007154 File Offset: 0x00005354
422 {
424 add
425 {
426 if (Delegate.Combine(this.KeyGenerated, value) != null)
427 {
428 }
429 }
431 remove
432 {
433 if (Delegate.Remove(this.KeyGenerated, value) != null)
434 {
435 }
436 }
437 }
438
439 // Token: 0x04000170 RID: 368
440 private bool keypairGenerated;
441
442 // Token: 0x04000171 RID: 369
443 private bool m_disposed;
444
445 // Token: 0x04000172 RID: 370
446 private BigInteger p;
447
448 // Token: 0x04000173 RID: 371
449 private BigInteger q;
450
451 // Token: 0x04000174 RID: 372
452 private BigInteger g;
453
454 // Token: 0x04000175 RID: 373
455 private BigInteger x;
456
457 // Token: 0x04000176 RID: 374
458 private BigInteger y;
459
460 // Token: 0x04000177 RID: 375
461 private BigInteger j;
462
463 // Token: 0x04000178 RID: 376
465
466 // Token: 0x04000179 RID: 377
467 private int counter;
468
469 // Token: 0x0400017A RID: 378
470 private bool j_missing;
471
472 // Token: 0x0400017B RID: 379
474
475 // Token: 0x0400017C RID: 380
478
479 // Token: 0x0200004E RID: 78
481 {
482 // Token: 0x060001B8 RID: 440 RVA: 0x00007178 File Offset: 0x00005378
483 public KeyGeneratedEventHandler(object @object, IntPtr method)
484 {
486 this.m_target = @object;
488 this.method_code = this;
489 }
490
491 // Token: 0x060001B9 RID: 441 RVA: 0x000071D8 File Offset: 0x000053D8
492 public void Invoke(object sender, EventArgs e)
493 {
496 IntPtr method = this.method;
497 }
498 }
499 }
500}
class f__AnonymousType0<< Count > j__TPar
static string GetText(string msg)
Definition Locale.cs:8
static uint modInverse(BigInteger bi, uint modulus)
static BigInteger.Sign Compare(BigInteger bi1, BigInteger bi2)
static BigInteger[] multiByteDivide(BigInteger bi1, BigInteger bi2)
BigInteger ModPow(BigInteger exp, BigInteger n)
void Randomize(RandomNumberGenerator rng)
static BigInteger GenerateRandom(int bits, RandomNumberGenerator rng)
override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
override DSAParameters ExportParameters(bool includePrivateParameters)
override void Dispose(bool disposing)
override byte[] CreateSignature(byte[] rgbHash)
DSAManaged.KeyGeneratedEventHandler KeyGenerated
void add(byte[] a, byte[] b, int value)
Definition DSAManaged.cs:64
byte[] NormalizeArray(byte[] array)
override void ImportParameters(DSAParameters parameters)
static Delegate Combine(Delegate a, Delegate b)
Definition Delegate.cs:255
IntPtr method_code
Definition Delegate.cs:386
IntPtr invoke_impl
Definition Delegate.cs:371
static Delegate Remove(Delegate source, Delegate value)
Definition Delegate.cs:278
static new SHA1 Create()
Definition SHA1.cs:18