242 lines
11 KiB
C#
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: 0x02001BAB RID: 7083
|
|
[Token(Token = "0x2001BAB")]
|
|
public class Ed448Signer : ISigner
|
|
{
|
|
// Token: 0x0600B108 RID: 45320 RVA: 0x002677D0 File Offset: 0x002659D0
|
|
[Token(Token = "0x600B108")]
|
|
[Address(RVA = "0x1896310", Offset = "0x1895110", VA = "0x181896310")]
|
|
public Ed448Signer(byte[] context)
|
|
{
|
|
Ed448Signer.Buffer buffer = new Ed448Signer.Buffer();
|
|
this.buffer = buffer;
|
|
base..ctor();
|
|
byte[] array = Arrays.Clone(context);
|
|
this.context = array;
|
|
}
|
|
|
|
// Token: 0x17001BE1 RID: 7137
|
|
// (get) Token: 0x0600B109 RID: 45321 RVA: 0x00267800 File Offset: 0x00265A00
|
|
[Token(Token = "0x17001BE1")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B109")]
|
|
[Address(RVA = "0x18963B0", Offset = "0x18951B0", VA = "0x1818963B0", Slot = "11")]
|
|
get
|
|
{
|
|
return "Ed448";
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B10A RID: 45322 RVA: 0x00267814 File Offset: 0x00265A14
|
|
[Token(Token = "0x600B10A")]
|
|
[Address(RVA = "0x1896180", Offset = "0x1894F80", VA = "0x181896180", 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: 0x0600B10B RID: 45323 RVA: 0x0026785C File Offset: 0x00265A5C
|
|
[Token(Token = "0x600B10B")]
|
|
[Address(RVA = "0x18956C0", Offset = "0x18944C0", VA = "0x1818956C0", Slot = "13")]
|
|
public virtual void Update(byte b)
|
|
{
|
|
((IDisposable)this.buffer).Dispose();
|
|
}
|
|
|
|
// Token: 0x0600B10C RID: 45324 RVA: 0x0026787C File Offset: 0x00265A7C
|
|
[Token(Token = "0x600B10C")]
|
|
[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: 0x0600B10D RID: 45325 RVA: 0x002678A0 File Offset: 0x00265AA0
|
|
[Token(Token = "0x600B10D")]
|
|
[Address(RVA = "0x18960F0", Offset = "0x1894EF0", VA = "0x1818960F0", Slot = "15")]
|
|
public virtual byte[] GenerateSignature()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B10D)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600B10E RID: 45326 RVA: 0x002678EC File Offset: 0x00265AEC
|
|
[Token(Token = "0x600B10E")]
|
|
[Address(RVA = "0x1896270", Offset = "0x1895070", VA = "0x181896270", Slot = "16")]
|
|
public virtual bool VerifySignature(byte[] signature)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B10E)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600B10F RID: 45327 RVA: 0x00267930 File Offset: 0x00265B30
|
|
[Token(Token = "0x600B10F")]
|
|
[Address(RVA = "0x1896250", Offset = "0x1895050", VA = "0x181896250", Slot = "17")]
|
|
public virtual void Reset()
|
|
{
|
|
this.buffer.Reset();
|
|
}
|
|
|
|
// Token: 0x040070B6 RID: 28854
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40070B6")]
|
|
private readonly Ed448Signer.Buffer buffer;
|
|
|
|
// Token: 0x040070B7 RID: 28855
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40070B7")]
|
|
private readonly byte[] context;
|
|
|
|
// Token: 0x040070B8 RID: 28856
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40070B8")]
|
|
private bool forSigning;
|
|
|
|
// Token: 0x040070B9 RID: 28857
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40070B9")]
|
|
private Ed448PrivateKeyParameters privateKey;
|
|
|
|
// Token: 0x040070BA RID: 28858
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40070BA")]
|
|
private Ed448PublicKeyParameters publicKey;
|
|
|
|
// Token: 0x02001BAC RID: 7084
|
|
[Token(Token = "0x2001BAC")]
|
|
private class Buffer : MemoryStream
|
|
{
|
|
// Token: 0x0600B110 RID: 45328 RVA: 0x00267950 File Offset: 0x00265B50
|
|
[Token(Token = "0x600B110")]
|
|
[Address(RVA = "0x1890620", Offset = "0x188F420", VA = "0x181890620")]
|
|
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);
|
|
}
|
|
while (num != 0);
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x0600B111 RID: 45329 RVA: 0x00267988 File Offset: 0x00265B88
|
|
[Token(Token = "0x600B111")]
|
|
[Address(RVA = "0x1891030", Offset = "0x188FE30", VA = "0x181891030")]
|
|
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);
|
|
}
|
|
while (num != 0);
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x0600B112 RID: 45330 RVA: 0x002679D4 File Offset: 0x00265BD4
|
|
[Token(Token = "0x600B112")]
|
|
[Address(RVA = "0x1890AE0", Offset = "0x188F8E0", VA = "0x181890AE0")]
|
|
internal void Reset()
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
long length = this.Length;
|
|
long position = this.Position;
|
|
Monitor.Exit(this);
|
|
}
|
|
while (num != 0);
|
|
}
|
|
|
|
// Token: 0x0600B113 RID: 45331 RVA: 0x002679FC File Offset: 0x00265BFC
|
|
[Token(Token = "0x600B113")]
|
|
[Address(RVA = "0x18911A0", Offset = "0x188FFA0", VA = "0x1818911A0")]
|
|
public Buffer()
|
|
{
|
|
}
|
|
}
|
|
}
|
|
}
|