227 lines
13 KiB
C#
227 lines
13 KiB
C#
using System;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Digests;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Utilities;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC.Rfc8032;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs
|
|
{
|
|
// Token: 0x02001D2D RID: 7469
|
|
[Token(Token = "0x2001D2D")]
|
|
public class Dstu7564Mac : IMac
|
|
{
|
|
// Token: 0x17001D2B RID: 7467
|
|
// (get) Token: 0x0600B915 RID: 47381 RVA: 0x002826EC File Offset: 0x002808EC
|
|
[Token(Token = "0x17001D2B")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B915")]
|
|
[Address(RVA = "0x25B7660", Offset = "0x25B6660", VA = "0x1825B7660", Slot = "5")]
|
|
get
|
|
{
|
|
return "DSTU7564Mac";
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B916 RID: 47382 RVA: 0x00282700 File Offset: 0x00280900
|
|
[Token(Token = "0x600B916")]
|
|
[Address(RVA = "0x25B75E0", Offset = "0x25B65E0", VA = "0x1825B75E0")]
|
|
public Dstu7564Mac(int macSizeBits)
|
|
{
|
|
Dstu7564Digest dstu7564Digest = new Dstu7564Digest(macSizeBits);
|
|
this.engine = dstu7564Digest;
|
|
this.macSize = macSizeBits;
|
|
}
|
|
|
|
// Token: 0x0600B917 RID: 47383 RVA: 0x00282728 File Offset: 0x00280928
|
|
[Token(Token = "0x600B917")]
|
|
[Address(RVA = "0x25B7030", Offset = "0x25B6030", VA = "0x1825B7030", Slot = "4")]
|
|
public void Init(ICipherParameters parameters)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B917)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.Dstu7564Mac::Init(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_74:
|
|
stloc:ArgumentException(var_11_7E, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Bad parameter passed")))
|
|
}
|
|
|
|
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: 0x0600B918 RID: 47384 RVA: 0x002827B4 File Offset: 0x002809B4
|
|
[Token(Token = "0x600B918")]
|
|
[Address(RVA = "0x411540", Offset = "0x410540", VA = "0x180411540", Slot = "6")]
|
|
public int GetMacSize()
|
|
{
|
|
return this.macSize;
|
|
}
|
|
|
|
// Token: 0x0600B919 RID: 47385 RVA: 0x002827C8 File Offset: 0x002809C8
|
|
[Token(Token = "0x600B919")]
|
|
[Address(RVA = "0x25B6CE0", Offset = "0x25B5CE0", VA = "0x1825B6CE0", Slot = "8")]
|
|
public void BlockUpdate(byte[] input, int inOff, int len)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B919)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.Dstu7564Mac::BlockUpdate(System.Byte[],System.Int32,System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_25:
|
|
stloc:InvalidOperationException(var_1_3A, newobj:InvalidOperationException(InvalidOperationException::.ctor, call:string(string::Concat, callgetter:string(Dstu7564Mac::get_AlgorithmName, ldloc:Dstu7564Mac(this)), ldstr:string(" not initialised"))))
|
|
}
|
|
|
|
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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
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: 0x0600B91A RID: 47386 RVA: 0x00282810 File Offset: 0x00280A10
|
|
[Token(Token = "0x600B91A")]
|
|
[Address(RVA = "0x25B75A0", Offset = "0x25B65A0", VA = "0x1825B75A0", Slot = "7")]
|
|
public void Update(byte input)
|
|
{
|
|
int byteLength = this.engine.GetByteLength();
|
|
}
|
|
|
|
// Token: 0x0600B91B RID: 47387 RVA: 0x00282830 File Offset: 0x00280A30
|
|
[Token(Token = "0x600B91B")]
|
|
[Address(RVA = "0x25B6DE0", Offset = "0x25B5DE0", VA = "0x1825B6DE0", Slot = "9")]
|
|
public int DoFinal(byte[] output, int outOff)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B91B)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Int32 BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Macs.Dstu7564Mac::DoFinal(System.Byte[],System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_C4:
|
|
stloc:InvalidOperationException(var_11_D9, newobj:InvalidOperationException(InvalidOperationException::.ctor, call:string(string::Concat, callgetter:string(Dstu7564Mac::get_AlgorithmName, ldloc:Dstu7564Mac(this)), ldstr:string(" not initialised"))))
|
|
}
|
|
|
|
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: 0x0600B91C RID: 47388 RVA: 0x00282918 File Offset: 0x00280B18
|
|
[Token(Token = "0x600B91C")]
|
|
[Address(RVA = "0x25B7530", Offset = "0x25B6530", VA = "0x1825B7530", Slot = "10")]
|
|
public void Reset()
|
|
{
|
|
this.inputLength = (ulong)0L;
|
|
Dstu7564Digest dstu7564Digest = this.engine;
|
|
byte[] array = this.paddedKey;
|
|
if (array != 0)
|
|
{
|
|
this.engine.Update(array);
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B91D RID: 47389 RVA: 0x00282954 File Offset: 0x00280B54
|
|
[Token(Token = "0x600B91D")]
|
|
[Address(RVA = "0x25B7400", Offset = "0x25B6400", VA = "0x1825B7400")]
|
|
private void Pad()
|
|
{
|
|
int num = this.engine.GetDigestSize();
|
|
int digestSize = this.engine.GetDigestSize();
|
|
int num2 = 0;
|
|
num -= num2;
|
|
if (num < 13)
|
|
{
|
|
int digestSize2 = this.engine.GetDigestSize();
|
|
num += digestSize2;
|
|
}
|
|
byte[] array = new byte[num];
|
|
array[0] = (byte)((ulong)128L);
|
|
int length = array.Length;
|
|
Pack.UInt64_To_LE(this.inputLength, array, length);
|
|
this.engine.Update(array);
|
|
}
|
|
|
|
// Token: 0x0600B91E RID: 47390 RVA: 0x002829D8 File Offset: 0x00280BD8
|
|
[Token(Token = "0x600B91E")]
|
|
[Address(RVA = "0x25B7250", Offset = "0x25B6250", VA = "0x1825B7250")]
|
|
private byte[] PadKey(byte[] input)
|
|
{
|
|
int num = this.engine.GetDigestSize();
|
|
int num2 = this.engine.GetDigestSize();
|
|
int digestSize = this.engine.GetDigestSize();
|
|
Dstu7564Digest dstu7564Digest = this.engine;
|
|
int num3 = input.Length;
|
|
num3 += num;
|
|
num2 = num3;
|
|
int num4 = num2 * digestSize;
|
|
int digestSize2 = dstu7564Digest.GetDigestSize();
|
|
Dstu7564Digest dstu7564Digest2 = this.engine;
|
|
num = digestSize2;
|
|
int digestSize3 = dstu7564Digest2.GetDigestSize();
|
|
if (num < 13)
|
|
{
|
|
int digestSize4 = this.engine.GetDigestSize();
|
|
num4 += digestSize4;
|
|
}
|
|
byte[] array = new byte[num4];
|
|
int length = input.Length;
|
|
int num5 = 0;
|
|
int num6 = 0;
|
|
Array.Copy(input, num6, array, num5, length);
|
|
int length2 = input.Length;
|
|
int length3 = array.Length;
|
|
Ed25519.Encode32((uint)input.Length, array, length3);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x040074B9 RID: 29881
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40074B9")]
|
|
private Dstu7564Digest engine;
|
|
|
|
// Token: 0x040074BA RID: 29882
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40074BA")]
|
|
private int macSize;
|
|
|
|
// Token: 0x040074BB RID: 29883
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40074BB")]
|
|
private ulong inputLength;
|
|
|
|
// Token: 0x040074BC RID: 29884
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40074BC")]
|
|
private byte[] paddedKey;
|
|
|
|
// Token: 0x040074BD RID: 29885
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40074BD")]
|
|
private byte[] invertedKey;
|
|
}
|
|
}
|