241 lines
11 KiB
C#
241 lines
11 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
using System.Threading;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers
|
|
{
|
|
// Token: 0x020015C9 RID: 5577
|
|
[Token(Token = "0x20015C9")]
|
|
[StructLayout(3)]
|
|
public class Ed25519Signer : ISigner
|
|
{
|
|
// Token: 0x0600950E RID: 38158 RVA: 0x0020FB28 File Offset: 0x0020DD28
|
|
[Token(Token = "0x600950E")]
|
|
[Address(RVA = "0x1E3DF00", Offset = "0x1E3C900", VA = "0x181E3DF00")]
|
|
public Ed25519Signer()
|
|
{
|
|
Ed25519Signer.Buffer buffer = new Ed25519Signer.Buffer();
|
|
this.buffer = buffer;
|
|
base..ctor();
|
|
}
|
|
|
|
// Token: 0x170017DD RID: 6109
|
|
// (get) Token: 0x0600950F RID: 38159 RVA: 0x0020FB48 File Offset: 0x0020DD48
|
|
[Token(Token = "0x170017DD")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600950F")]
|
|
[Address(RVA = "0x1E3DF60", Offset = "0x1E3C960", VA = "0x181E3DF60", Slot = "11")]
|
|
get
|
|
{
|
|
return "Ed25519";
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009510 RID: 38160 RVA: 0x0020FB5C File Offset: 0x0020DD5C
|
|
[Token(Token = "0x6009510")]
|
|
[Address(RVA = "0x1E3DD80", Offset = "0x1E3C780", VA = "0x181E3DD80", Slot = "12")]
|
|
public virtual void Init(bool forSigning, ICipherParameters parameters)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
this.forSigning = forSigning;
|
|
num = 0;
|
|
if (!forSigning)
|
|
{
|
|
this.privateKey = num;
|
|
if (parameters == 0)
|
|
{
|
|
goto IL_2B;
|
|
}
|
|
if (parameters == 0)
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
while (parameters != 0 && parameters == 0);
|
|
this.privateKey = num;
|
|
IL_2B:
|
|
Ed25519PublicKeyParameters ed25519PublicKeyParameters;
|
|
this.publicKey = ed25519PublicKeyParameters;
|
|
string algorithmName = ((ISigner)this).AlgorithmName;
|
|
}
|
|
|
|
// Token: 0x06009511 RID: 38161 RVA: 0x0020FBA4 File Offset: 0x0020DDA4
|
|
[Token(Token = "0x6009511")]
|
|
[Address(RVA = "0xA20E50", Offset = "0xA1F850", VA = "0x180A20E50", Slot = "13")]
|
|
public virtual void Update(byte b)
|
|
{
|
|
((IDisposable)this.buffer).Dispose();
|
|
}
|
|
|
|
// Token: 0x06009512 RID: 38162 RVA: 0x0020FBC4 File Offset: 0x0020DDC4
|
|
[Token(Token = "0x6009512")]
|
|
[Address(RVA = "0xA20FC0", Offset = "0xA1F9C0", VA = "0x180A20FC0", Slot = "14")]
|
|
public virtual void BlockUpdate(byte[] buf, int off, int len)
|
|
{
|
|
int num = this.buffer.Read(buf, off, len);
|
|
}
|
|
|
|
// Token: 0x06009513 RID: 38163 RVA: 0x0020FBE8 File Offset: 0x0020DDE8
|
|
[Token(Token = "0x6009513")]
|
|
[Address(RVA = "0x1E3DCF0", Offset = "0x1E3C6F0", VA = "0x181E3DCF0", Slot = "15")]
|
|
public virtual byte[] GenerateSignature()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009513)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.Ed25519Signer::GenerateSignature()
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_2B:
|
|
stloc:InvalidOperationException(var_3_35, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("Ed25519Signer not initialised for signature generation.")))
|
|
}
|
|
|
|
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: 0x06009514 RID: 38164 RVA: 0x0020FC2C File Offset: 0x0020DE2C
|
|
[Token(Token = "0x6009514")]
|
|
[Address(RVA = "0x1E3DE70", Offset = "0x1E3C870", VA = "0x181E3DE70", Slot = "16")]
|
|
public virtual bool VerifySignature(byte[] signature)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009514)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.Ed25519Signer::VerifySignature(System.Byte[])
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_22:
|
|
stloc:InvalidOperationException(var_1_2C, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("Ed25519Signer not initialised for verification")))
|
|
}
|
|
|
|
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: 0x06009515 RID: 38165 RVA: 0x0020FC68 File Offset: 0x0020DE68
|
|
[Token(Token = "0x6009515")]
|
|
[Address(RVA = "0x1E3DE50", Offset = "0x1E3C850", VA = "0x181E3DE50", Slot = "17")]
|
|
public virtual void Reset()
|
|
{
|
|
this.buffer.Reset();
|
|
}
|
|
|
|
// Token: 0x04006265 RID: 25189
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006265")]
|
|
private readonly Ed25519Signer.Buffer buffer;
|
|
|
|
// Token: 0x04006266 RID: 25190
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006266")]
|
|
private bool forSigning;
|
|
|
|
// Token: 0x04006267 RID: 25191
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006267")]
|
|
private Ed25519PrivateKeyParameters privateKey;
|
|
|
|
// Token: 0x04006268 RID: 25192
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4006268")]
|
|
private Ed25519PublicKeyParameters publicKey;
|
|
|
|
// Token: 0x020015CA RID: 5578
|
|
[Token(Token = "0x20015CA")]
|
|
private class Buffer : MemoryStream
|
|
{
|
|
// Token: 0x06009516 RID: 38166 RVA: 0x0020FC88 File Offset: 0x0020DE88
|
|
[Token(Token = "0x6009516")]
|
|
[Address(RVA = "0x1E38E30", Offset = "0x1E37830", VA = "0x181E38E30")]
|
|
internal byte[] GenerateSignature(Ed25519PrivateKeyParameters privateKey, Ed25519PublicKeyParameters publicKey)
|
|
{
|
|
int num;
|
|
byte[] array;
|
|
do
|
|
{
|
|
num = 0;
|
|
long length = this.Length;
|
|
array = new byte[Ed25519PrivateKeyParameters.SignatureSize];
|
|
this.Reset();
|
|
Monitor.Exit(this);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06009517 RID: 38167 RVA: 0x0020FCC4 File Offset: 0x0020DEC4
|
|
[Token(Token = "0x6009517")]
|
|
[Address(RVA = "0x1E39650", Offset = "0x1E38050", VA = "0x181E39650")]
|
|
internal bool VerifySignature(Ed25519PublicKeyParameters publicKey, byte[] signature)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
long length = this.Length;
|
|
byte[] encoded = publicKey.GetEncoded();
|
|
this.Reset();
|
|
Monitor.Exit(this);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
bool flag;
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x06009518 RID: 38168 RVA: 0x0020FCFC File Offset: 0x0020DEFC
|
|
[Token(Token = "0x6009518")]
|
|
[Address(RVA = "0x1E393B0", Offset = "0x1E37DB0", VA = "0x181E393B0")]
|
|
internal void Reset()
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
long length = this.Length;
|
|
long position = this.Position;
|
|
Monitor.Exit(this);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x06009519 RID: 38169 RVA: 0x0020FD28 File Offset: 0x0020DF28
|
|
[Token(Token = "0x6009519")]
|
|
[Address(RVA = "0x1E39980", Offset = "0x1E38380", VA = "0x181E39980")]
|
|
public Buffer()
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|