Files
Apr2020-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Signers/Ed25519ctxSigner.cs
T
niko 8fc35183db a
2026-04-11 22:19:20 +02:00

242 lines
11 KiB
C#

using System;
using System.IO;
using System.Threading;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC.Rfc8032;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers
{
// Token: 0x02001BA8 RID: 7080
[Token(Token = "0x2001BA8")]
public class Ed25519ctxSigner : ISigner
{
// Token: 0x0600B0F4 RID: 45300 RVA: 0x002673C0 File Offset: 0x002655C0
[Token(Token = "0x600B0F4")]
[Address(RVA = "0x1895A30", Offset = "0x1894830", VA = "0x181895A30")]
public Ed25519ctxSigner(byte[] context)
{
Ed25519ctxSigner.Buffer buffer = new Ed25519ctxSigner.Buffer();
this.buffer = buffer;
base..ctor();
byte[] array = Arrays.Clone(context);
this.context = array;
}
// Token: 0x17001BDF RID: 7135
// (get) Token: 0x0600B0F5 RID: 45301 RVA: 0x002673F0 File Offset: 0x002655F0
[Token(Token = "0x17001BDF")]
public virtual string AlgorithmName
{
[Token(Token = "0x600B0F5")]
[Address(RVA = "0x1895AD0", Offset = "0x18948D0", VA = "0x181895AD0", Slot = "11")]
get
{
return "Ed25519ctx";
}
}
// Token: 0x0600B0F6 RID: 45302 RVA: 0x00267404 File Offset: 0x00265604
[Token(Token = "0x600B0F6")]
[Address(RVA = "0x18958A0", Offset = "0x18946A0", VA = "0x1818958A0", 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: 0x0600B0F7 RID: 45303 RVA: 0x0026744C File Offset: 0x0026564C
[Token(Token = "0x600B0F7")]
[Address(RVA = "0x18956C0", Offset = "0x18944C0", VA = "0x1818956C0", Slot = "13")]
public virtual void Update(byte b)
{
((IDisposable)this.buffer).Dispose();
}
// Token: 0x0600B0F8 RID: 45304 RVA: 0x0026746C File Offset: 0x0026566C
[Token(Token = "0x600B0F8")]
[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: 0x0600B0F9 RID: 45305 RVA: 0x00267490 File Offset: 0x00265690
[Token(Token = "0x600B0F9")]
[Address(RVA = "0x1895810", Offset = "0x1894610", VA = "0x181895810", Slot = "15")]
public virtual byte[] GenerateSignature()
{
/*
An exception occurred when decompiling this method (0600B0F9)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.Ed25519ctxSigner::GenerateSignature()
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_33:
stloc:InvalidOperationException(var_5_3D, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("Ed25519ctxSigner 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: 0x0600B0FA RID: 45306 RVA: 0x002674DC File Offset: 0x002656DC
[Token(Token = "0x600B0FA")]
[Address(RVA = "0x1895990", Offset = "0x1894790", VA = "0x181895990", Slot = "16")]
public virtual bool VerifySignature(byte[] signature)
{
/*
An exception occurred when decompiling this method (0600B0FA)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.Ed25519ctxSigner::VerifySignature(System.Byte[])
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_2C:
stloc:InvalidOperationException(var_4_36, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("Ed25519ctxSigner 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: 0x0600B0FB RID: 45307 RVA: 0x00267520 File Offset: 0x00265720
[Token(Token = "0x600B0FB")]
[Address(RVA = "0x1895970", Offset = "0x1894770", VA = "0x181895970", Slot = "17")]
public virtual void Reset()
{
this.buffer.Reset();
}
// Token: 0x040070AC RID: 28844
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40070AC")]
private readonly Ed25519ctxSigner.Buffer buffer;
// Token: 0x040070AD RID: 28845
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40070AD")]
private readonly byte[] context;
// Token: 0x040070AE RID: 28846
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40070AE")]
private bool forSigning;
// Token: 0x040070AF RID: 28847
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x40070AF")]
private Ed25519PrivateKeyParameters privateKey;
// Token: 0x040070B0 RID: 28848
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x40070B0")]
private Ed25519PublicKeyParameters publicKey;
// Token: 0x02001BA9 RID: 7081
[Token(Token = "0x2001BA9")]
private class Buffer : MemoryStream
{
// Token: 0x0600B0FC RID: 45308 RVA: 0x00267540 File Offset: 0x00265740
[Token(Token = "0x600B0FC")]
[Address(RVA = "0x1890940", Offset = "0x188F740", VA = "0x181890940")]
internal byte[] GenerateSignature(Ed25519PrivateKeyParameters privateKey, Ed25519PublicKeyParameters publicKey, byte[] ctx)
{
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: 0x0600B0FD RID: 45309 RVA: 0x00267578 File Offset: 0x00265778
[Token(Token = "0x600B0FD")]
[Address(RVA = "0x1890D50", Offset = "0x188FB50", VA = "0x181890D50")]
internal bool VerifySignature(Ed25519PublicKeyParameters publicKey, byte[] ctx, byte[] signature)
{
int num;
bool flag;
do
{
num = 0;
long length = this.Length;
byte[] encoded = publicKey.GetEncoded();
int num2 = 0;
int num3 = 0;
flag = Ed25519.Verify(signature, num3, encoded, num2, ctx, encoded, num, (int)length);
this.Reset();
Monitor.Exit(this);
}
while (num != 0);
return flag;
}
// Token: 0x0600B0FE RID: 45310 RVA: 0x002675C4 File Offset: 0x002657C4
[Token(Token = "0x600B0FE")]
[Address(RVA = "0x1890BB0", Offset = "0x188F9B0", VA = "0x181890BB0")]
internal void Reset()
{
int num;
do
{
num = 0;
long length = this.Length;
long position = this.Position;
Monitor.Exit(this);
}
while (num != 0);
}
// Token: 0x0600B0FF RID: 45311 RVA: 0x002675EC File Offset: 0x002657EC
[Token(Token = "0x600B0FF")]
[Address(RVA = "0x18911A0", Offset = "0x188FFA0", VA = "0x1818911A0")]
public Buffer()
{
}
}
}
}