230 lines
10 KiB
C#
230 lines
10 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Threading;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers
|
|
{
|
|
// Token: 0x02001BA6 RID: 7078
|
|
[Token(Token = "0x2001BA6")]
|
|
public class Ed25519Signer : ISigner
|
|
{
|
|
// Token: 0x0600B0E8 RID: 45288 RVA: 0x002671B8 File Offset: 0x002653B8
|
|
[Token(Token = "0x600B0E8")]
|
|
[Address(RVA = "0x1895780", Offset = "0x1894580", VA = "0x181895780")]
|
|
public Ed25519Signer()
|
|
{
|
|
Ed25519Signer.Buffer buffer = new Ed25519Signer.Buffer();
|
|
this.buffer = buffer;
|
|
base..ctor();
|
|
}
|
|
|
|
// Token: 0x17001BDE RID: 7134
|
|
// (get) Token: 0x0600B0E9 RID: 45289 RVA: 0x002671D8 File Offset: 0x002653D8
|
|
[Token(Token = "0x17001BDE")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B0E9")]
|
|
[Address(RVA = "0x18957E0", Offset = "0x18945E0", VA = "0x1818957E0", Slot = "11")]
|
|
get
|
|
{
|
|
return "Ed25519";
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B0EA RID: 45290 RVA: 0x002671EC File Offset: 0x002653EC
|
|
[Token(Token = "0x600B0EA")]
|
|
[Address(RVA = "0x18955D0", Offset = "0x18943D0", VA = "0x1818955D0", 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: 0x0600B0EB RID: 45291 RVA: 0x00267234 File Offset: 0x00265434
|
|
[Token(Token = "0x600B0EB")]
|
|
[Address(RVA = "0x18956C0", Offset = "0x18944C0", VA = "0x1818956C0", Slot = "13")]
|
|
public virtual void Update(byte b)
|
|
{
|
|
((IDisposable)this.buffer).Dispose();
|
|
}
|
|
|
|
// Token: 0x0600B0EC RID: 45292 RVA: 0x00267254 File Offset: 0x00265454
|
|
[Token(Token = "0x600B0EC")]
|
|
[Address(RVA = "0x1895510", Offset = "0x1894310", VA = "0x181895510", Slot = "14")]
|
|
public virtual void BlockUpdate(byte[] buf, int off, int len)
|
|
{
|
|
int num = this.buffer.Read(buf, off, len);
|
|
}
|
|
|
|
// Token: 0x0600B0ED RID: 45293 RVA: 0x00267278 File Offset: 0x00265478
|
|
[Token(Token = "0x600B0ED")]
|
|
[Address(RVA = "0x1895540", Offset = "0x1894340", VA = "0x181895540", Slot = "15")]
|
|
public virtual byte[] GenerateSignature()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B0ED)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600B0EE RID: 45294 RVA: 0x002672BC File Offset: 0x002654BC
|
|
[Token(Token = "0x600B0EE")]
|
|
[Address(RVA = "0x18956F0", Offset = "0x18944F0", VA = "0x1818956F0", Slot = "16")]
|
|
public virtual bool VerifySignature(byte[] signature)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B0EE)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600B0EF RID: 45295 RVA: 0x002672F8 File Offset: 0x002654F8
|
|
[Token(Token = "0x600B0EF")]
|
|
[Address(RVA = "0x18956A0", Offset = "0x18944A0", VA = "0x1818956A0", Slot = "17")]
|
|
public virtual void Reset()
|
|
{
|
|
this.buffer.Reset();
|
|
}
|
|
|
|
// Token: 0x040070A8 RID: 28840
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40070A8")]
|
|
private readonly Ed25519Signer.Buffer buffer;
|
|
|
|
// Token: 0x040070A9 RID: 28841
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40070A9")]
|
|
private bool forSigning;
|
|
|
|
// Token: 0x040070AA RID: 28842
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40070AA")]
|
|
private Ed25519PrivateKeyParameters privateKey;
|
|
|
|
// Token: 0x040070AB RID: 28843
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40070AB")]
|
|
private Ed25519PublicKeyParameters publicKey;
|
|
|
|
// Token: 0x02001BA7 RID: 7079
|
|
[Token(Token = "0x2001BA7")]
|
|
private class Buffer : MemoryStream
|
|
{
|
|
// Token: 0x0600B0F0 RID: 45296 RVA: 0x00267318 File Offset: 0x00265518
|
|
[Token(Token = "0x600B0F0")]
|
|
[Address(RVA = "0x18907B0", Offset = "0x188F5B0", VA = "0x1818907B0")]
|
|
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);
|
|
}
|
|
while (num != 0);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x0600B0F1 RID: 45297 RVA: 0x00267350 File Offset: 0x00265550
|
|
[Token(Token = "0x600B0F1")]
|
|
[Address(RVA = "0x1890EC0", Offset = "0x188FCC0", VA = "0x181890EC0")]
|
|
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);
|
|
}
|
|
while (num != 0);
|
|
bool flag;
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x0600B0F2 RID: 45298 RVA: 0x00267384 File Offset: 0x00265584
|
|
[Token(Token = "0x600B0F2")]
|
|
[Address(RVA = "0x1890C80", Offset = "0x188FA80", VA = "0x181890C80")]
|
|
internal void Reset()
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
long length = this.Length;
|
|
long position = this.Position;
|
|
Monitor.Exit(this);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600B0F3 RID: 45299 RVA: 0x002673AC File Offset: 0x002655AC
|
|
[Token(Token = "0x600B0F3")]
|
|
[Address(RVA = "0x18911A0", Offset = "0x188FFA0", VA = "0x1818911A0")]
|
|
public Buffer()
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|