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: 0x020015CB RID: 5579 [Token(Token = "0x20015CB")] [StructLayout(3)] public class Ed25519ctxSigner : ISigner { // Token: 0x0600951A RID: 38170 RVA: 0x0020FD3C File Offset: 0x0020DF3C [Token(Token = "0x600951A")] [Address(RVA = "0x1E3E1B0", Offset = "0x1E3CBB0", VA = "0x181E3E1B0")] public Ed25519ctxSigner(byte[] context) { Ed25519ctxSigner.Buffer buffer = new Ed25519ctxSigner.Buffer(); this.buffer = buffer; base..ctor(); byte[] array = Arrays.Clone(context); this.context = array; } // Token: 0x170017DE RID: 6110 // (get) Token: 0x0600951B RID: 38171 RVA: 0x0020FD6C File Offset: 0x0020DF6C [Token(Token = "0x170017DE")] public virtual string AlgorithmName { [Token(Token = "0x600951B")] [Address(RVA = "0x1E3E250", Offset = "0x1E3CC50", VA = "0x181E3E250", Slot = "11")] get { return "Ed25519ctx"; } } // Token: 0x0600951C RID: 38172 RVA: 0x0020FD80 File Offset: 0x0020DF80 [Token(Token = "0x600951C")] [Address(RVA = "0x1E3E020", Offset = "0x1E3CA20", VA = "0x181E3E020", 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: 0x0600951D RID: 38173 RVA: 0x0020FDC8 File Offset: 0x0020DFC8 [Token(Token = "0x600951D")] [Address(RVA = "0xA20E50", Offset = "0xA1F850", VA = "0x180A20E50", Slot = "13")] public virtual void Update(byte b) { ((IDisposable)this.buffer).Dispose(); } // Token: 0x0600951E RID: 38174 RVA: 0x0020FDE8 File Offset: 0x0020DFE8 [Token(Token = "0x600951E")] [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: 0x0600951F RID: 38175 RVA: 0x0020FE0C File Offset: 0x0020E00C [Token(Token = "0x600951F")] [Address(RVA = "0x1E3DF90", Offset = "0x1E3C990", VA = "0x181E3DF90", Slot = "15")] public virtual byte[] GenerateSignature() { /* An exception occurred when decompiling this method (0600951F) 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 1663 */; } // Token: 0x06009520 RID: 38176 RVA: 0x0020FE58 File Offset: 0x0020E058 [Token(Token = "0x6009520")] [Address(RVA = "0x1E3E110", Offset = "0x1E3CB10", VA = "0x181E3E110", Slot = "16")] public virtual bool VerifySignature(byte[] signature) { /* An exception occurred when decompiling this method (06009520) 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 1663 */; } // Token: 0x06009521 RID: 38177 RVA: 0x0020FE9C File Offset: 0x0020E09C [Token(Token = "0x6009521")] [Address(RVA = "0x1E3E0F0", Offset = "0x1E3CAF0", VA = "0x181E3E0F0", Slot = "17")] public virtual void Reset() { this.buffer.Reset(); } // Token: 0x04006269 RID: 25193 [global::Cpp2IlInjected.FieldOffset(Offset = "0x10")] [Token(Token = "0x4006269")] private readonly Ed25519ctxSigner.Buffer buffer; // Token: 0x0400626A RID: 25194 [global::Cpp2IlInjected.FieldOffset(Offset = "0x18")] [Token(Token = "0x400626A")] private readonly byte[] context; // Token: 0x0400626B RID: 25195 [global::Cpp2IlInjected.FieldOffset(Offset = "0x20")] [Token(Token = "0x400626B")] private bool forSigning; // Token: 0x0400626C RID: 25196 [global::Cpp2IlInjected.FieldOffset(Offset = "0x28")] [Token(Token = "0x400626C")] private Ed25519PrivateKeyParameters privateKey; // Token: 0x0400626D RID: 25197 [global::Cpp2IlInjected.FieldOffset(Offset = "0x30")] [Token(Token = "0x400626D")] private Ed25519PublicKeyParameters publicKey; // Token: 0x020015CC RID: 5580 [Token(Token = "0x20015CC")] private class Buffer : MemoryStream { // Token: 0x06009522 RID: 38178 RVA: 0x0020FEBC File Offset: 0x0020E0BC [Token(Token = "0x6009522")] [Address(RVA = "0x1E38FE0", Offset = "0x1E379E0", VA = "0x181E38FE0")] 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); if (num != -1) { } } while (num != 0); return array; } // Token: 0x06009523 RID: 38179 RVA: 0x0020FEF8 File Offset: 0x0020E0F8 [Token(Token = "0x6009523")] [Address(RVA = "0x1E394B0", Offset = "0x1E37EB0", VA = "0x181E394B0")] 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); if (num != -1) { } } while (num != 0); return flag; } // Token: 0x06009524 RID: 38180 RVA: 0x0020FF48 File Offset: 0x0020E148 [Token(Token = "0x6009524")] [Address(RVA = "0x1E392B0", Offset = "0x1E37CB0", VA = "0x181E392B0")] 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: 0x06009525 RID: 38181 RVA: 0x0020FF74 File Offset: 0x0020E174 [Token(Token = "0x6009525")] [Address(RVA = "0x1E39980", Offset = "0x1E38380", VA = "0x181E39980")] public Buffer() { } } } }