253 lines
11 KiB
C#
253 lines
11 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
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: 0x020015CE RID: 5582
|
|
[Token(Token = "0x20015CE")]
|
|
[StructLayout(3)]
|
|
public class Ed448Signer : ISigner
|
|
{
|
|
// Token: 0x0600952E RID: 38190 RVA: 0x00210158 File Offset: 0x0020E358
|
|
[Token(Token = "0x600952E")]
|
|
[Address(RVA = "0x1E3EA90", Offset = "0x1E3D490", VA = "0x181E3EA90")]
|
|
public Ed448Signer(byte[] context)
|
|
{
|
|
Ed448Signer.Buffer buffer = new Ed448Signer.Buffer();
|
|
this.buffer = buffer;
|
|
base..ctor();
|
|
byte[] array = Arrays.Clone(context);
|
|
this.context = array;
|
|
}
|
|
|
|
// Token: 0x170017E0 RID: 6112
|
|
// (get) Token: 0x0600952F RID: 38191 RVA: 0x00210188 File Offset: 0x0020E388
|
|
[Token(Token = "0x170017E0")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600952F")]
|
|
[Address(RVA = "0x1E3EB30", Offset = "0x1E3D530", VA = "0x181E3EB30", Slot = "11")]
|
|
get
|
|
{
|
|
return "Ed448";
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009530 RID: 38192 RVA: 0x0021019C File Offset: 0x0020E39C
|
|
[Token(Token = "0x6009530")]
|
|
[Address(RVA = "0x1E3E900", Offset = "0x1E3D300", VA = "0x181E3E900", 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:
|
|
Ed448PublicKeyParameters ed448PublicKeyParameters;
|
|
this.publicKey = ed448PublicKeyParameters;
|
|
string algorithmName = ((ISigner)this).AlgorithmName;
|
|
}
|
|
|
|
// Token: 0x06009531 RID: 38193 RVA: 0x002101E4 File Offset: 0x0020E3E4
|
|
[Token(Token = "0x6009531")]
|
|
[Address(RVA = "0xA20E50", Offset = "0xA1F850", VA = "0x180A20E50", Slot = "13")]
|
|
public virtual void Update(byte b)
|
|
{
|
|
((IDisposable)this.buffer).Dispose();
|
|
}
|
|
|
|
// Token: 0x06009532 RID: 38194 RVA: 0x00210204 File Offset: 0x0020E404
|
|
[Token(Token = "0x6009532")]
|
|
[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: 0x06009533 RID: 38195 RVA: 0x00210228 File Offset: 0x0020E428
|
|
[Token(Token = "0x6009533")]
|
|
[Address(RVA = "0x1E3E870", Offset = "0x1E3D270", VA = "0x181E3E870", Slot = "15")]
|
|
public virtual byte[] GenerateSignature()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009533)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.Ed448Signer::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("Ed448Signer 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: 0x06009534 RID: 38196 RVA: 0x00210274 File Offset: 0x0020E474
|
|
[Token(Token = "0x6009534")]
|
|
[Address(RVA = "0x1E3E9F0", Offset = "0x1E3D3F0", VA = "0x181E3E9F0", Slot = "16")]
|
|
public virtual bool VerifySignature(byte[] signature)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009534)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.Ed448Signer::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("Ed448Signer 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: 0x06009535 RID: 38197 RVA: 0x002102B8 File Offset: 0x0020E4B8
|
|
[Token(Token = "0x6009535")]
|
|
[Address(RVA = "0x1E3E9D0", Offset = "0x1E3D3D0", VA = "0x181E3E9D0", Slot = "17")]
|
|
public virtual void Reset()
|
|
{
|
|
this.buffer.Reset();
|
|
}
|
|
|
|
// Token: 0x04006273 RID: 25203
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006273")]
|
|
private readonly Ed448Signer.Buffer buffer;
|
|
|
|
// Token: 0x04006274 RID: 25204
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006274")]
|
|
private readonly byte[] context;
|
|
|
|
// Token: 0x04006275 RID: 25205
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006275")]
|
|
private bool forSigning;
|
|
|
|
// Token: 0x04006276 RID: 25206
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4006276")]
|
|
private Ed448PrivateKeyParameters privateKey;
|
|
|
|
// Token: 0x04006277 RID: 25207
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4006277")]
|
|
private Ed448PublicKeyParameters publicKey;
|
|
|
|
// Token: 0x020015CF RID: 5583
|
|
[Token(Token = "0x20015CF")]
|
|
private class Buffer : MemoryStream
|
|
{
|
|
// Token: 0x06009536 RID: 38198 RVA: 0x002102D8 File Offset: 0x0020E4D8
|
|
[Token(Token = "0x6009536")]
|
|
[Address(RVA = "0x1E38C70", Offset = "0x1E37670", VA = "0x181E38C70")]
|
|
internal byte[] GenerateSignature(Ed448PrivateKeyParameters privateKey, Ed448PublicKeyParameters publicKey, byte[] ctx)
|
|
{
|
|
int num;
|
|
byte[] array;
|
|
do
|
|
{
|
|
num = 0;
|
|
long length = this.Length;
|
|
array = new byte[Ed448PrivateKeyParameters.SignatureSize];
|
|
this.Reset();
|
|
Monitor.Exit(this);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x06009537 RID: 38199 RVA: 0x00210314 File Offset: 0x0020E514
|
|
[Token(Token = "0x6009537")]
|
|
[Address(RVA = "0x1E397E0", Offset = "0x1E381E0", VA = "0x181E397E0")]
|
|
internal bool VerifySignature(Ed448PublicKeyParameters 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 = Ed448.Verify(signature, num3, encoded, num2, ctx, encoded, num, (int)length);
|
|
this.Reset();
|
|
Monitor.Exit(this);
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x06009538 RID: 38200 RVA: 0x00210364 File Offset: 0x0020E564
|
|
[Token(Token = "0x6009538")]
|
|
[Address(RVA = "0x1E391B0", Offset = "0x1E37BB0", VA = "0x181E391B0")]
|
|
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: 0x06009539 RID: 38201 RVA: 0x00210390 File Offset: 0x0020E590
|
|
[Token(Token = "0x6009539")]
|
|
[Address(RVA = "0x1E39980", Offset = "0x1E38380", VA = "0x181E39980")]
|
|
public Buffer()
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|