304 lines
15 KiB
C#
304 lines
15 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers
|
|
{
|
|
// Token: 0x020015E0 RID: 5600
|
|
[Token(Token = "0x20015E0")]
|
|
[StructLayout(3)]
|
|
public class X931Signer : ISigner
|
|
{
|
|
// Token: 0x060095CE RID: 38350 RVA: 0x002137A0 File Offset: 0x002119A0
|
|
[Token(Token = "0x60095CE")]
|
|
[Address(RVA = "0x1E4F330", Offset = "0x1E4DD30", VA = "0x181E4F330")]
|
|
public X931Signer(IAsymmetricBlockCipher cipher, IDigest digest, bool isImplicit)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (060095CE)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.X931Signer::.ctor(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IAsymmetricBlockCipher,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IDigest,System.Boolean)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_3D:
|
|
stloc:ArgumentException(var_1_4C, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("no valid trailer"), ldstr:string("digest")))
|
|
}
|
|
|
|
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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
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: 0x170017EE RID: 6126
|
|
// (get) Token: 0x060095CF RID: 38351 RVA: 0x002137FC File Offset: 0x002119FC
|
|
[Token(Token = "0x170017EE")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x60095CF")]
|
|
[Address(RVA = "0x1E4F430", Offset = "0x1E4DE30", VA = "0x181E4F430", Slot = "11")]
|
|
get
|
|
{
|
|
IDigest digest = this.digest;
|
|
IAsymmetricBlockCipher asymmetricBlockCipher = this.cipher;
|
|
string text;
|
|
return text;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060095D0 RID: 38352 RVA: 0x00213824 File Offset: 0x00211A24
|
|
[Token(Token = "0x60095D0")]
|
|
[Address(RVA = "0x1E4F240", Offset = "0x1E4DC40", VA = "0x181E4F240")]
|
|
public X931Signer(IAsymmetricBlockCipher cipher, IDigest digest)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (060095D0)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.X931Signer::.ctor(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IAsymmetricBlockCipher,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IDigest)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_2C:
|
|
stloc:ArgumentException(var_1_3B, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("no valid trailer"), ldstr:string("digest")))
|
|
}
|
|
|
|
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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
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: 0x060095D1 RID: 38353 RVA: 0x0021386C File Offset: 0x00211A6C
|
|
[Token(Token = "0x60095D1")]
|
|
[Address(RVA = "0x1E4EE80", Offset = "0x1E4D880", VA = "0x181E4EE80", Slot = "12")]
|
|
public virtual void Init(bool forSigning, ICipherParameters parameters)
|
|
{
|
|
do
|
|
{
|
|
if (parameters == 0)
|
|
{
|
|
}
|
|
}
|
|
while (parameters == 0);
|
|
IAsymmetricBlockCipher asymmetricBlockCipher = this.cipher;
|
|
this.kParam = parameters;
|
|
BigInteger modulus = this.kParam.modulus;
|
|
int num = 0;
|
|
int num2 = modulus.BitLength;
|
|
this.keyBits = num2;
|
|
num2 += 7;
|
|
num += num2;
|
|
byte[] array = new byte[num];
|
|
this.block = array;
|
|
string algorithmName = ((ISigner)this).AlgorithmName;
|
|
}
|
|
|
|
// Token: 0x060095D2 RID: 38354 RVA: 0x002138D4 File Offset: 0x00211AD4
|
|
[Token(Token = "0x60095D2")]
|
|
[Address(RVA = "0x1E43A90", Offset = "0x1E42490", VA = "0x181E43A90")]
|
|
private void ClearBlock(byte[] block)
|
|
{
|
|
int length = block.Length;
|
|
int num = 0;
|
|
Array.Clear(block, num, length);
|
|
}
|
|
|
|
// Token: 0x060095D3 RID: 38355 RVA: 0x002138F8 File Offset: 0x00211AF8
|
|
[Token(Token = "0x60095D3")]
|
|
[Address(RVA = "0x1E4EFE0", Offset = "0x1E4D9E0", VA = "0x181E4EFE0", Slot = "13")]
|
|
public virtual void Update(byte b)
|
|
{
|
|
IDigest digest = this.digest;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060095D4 RID: 38356 RVA: 0x00213914 File Offset: 0x00211B14
|
|
[Token(Token = "0x60095D4")]
|
|
[Address(RVA = "0x1E4EAE0", Offset = "0x1E4D4E0", VA = "0x181E4EAE0", Slot = "14")]
|
|
public virtual void BlockUpdate(byte[] input, int off, int len)
|
|
{
|
|
IDigest digest = this.digest;
|
|
}
|
|
|
|
// Token: 0x060095D5 RID: 38357 RVA: 0x00213930 File Offset: 0x00211B30
|
|
[Token(Token = "0x60095D5")]
|
|
[Address(RVA = "0x1E4EF90", Offset = "0x1E4D990", VA = "0x181E4EF90", Slot = "15")]
|
|
public virtual void Reset()
|
|
{
|
|
IDigest digest = this.digest;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060095D6 RID: 38358 RVA: 0x0021394C File Offset: 0x00211B4C
|
|
[Token(Token = "0x60095D6")]
|
|
[Address(RVA = "0x1E4ED60", Offset = "0x1E4D760", VA = "0x181E4ED60", Slot = "16")]
|
|
public virtual byte[] GenerateSignature()
|
|
{
|
|
this.CreateSignatureBlock();
|
|
byte[] array = this.block;
|
|
IAsymmetricBlockCipher asymmetricBlockCipher = this.cipher;
|
|
int length = array.Length;
|
|
byte[] array2 = this.block;
|
|
int length2 = array2.Length;
|
|
int num = 0;
|
|
Array.Clear(array2, num, length2);
|
|
BigInteger bigInteger2;
|
|
BigInteger bigInteger = this.kParam.modulus.Subtract(bigInteger2);
|
|
BigInteger bigInteger3 = bigInteger2.Min(bigInteger);
|
|
return BigIntegers.AsUnsignedByteArray(BigIntegers.GetUnsignedByteLength(this.kParam.modulus), bigInteger3);
|
|
}
|
|
|
|
// Token: 0x060095D7 RID: 38359 RVA: 0x002139D0 File Offset: 0x00211BD0
|
|
[Token(Token = "0x60095D7")]
|
|
[Address(RVA = "0x1E4EB60", Offset = "0x1E4D560", VA = "0x181E4EB60")]
|
|
private void CreateSignatureBlock()
|
|
{
|
|
IDigest digest = this.digest;
|
|
byte[] array = this.block;
|
|
if (this.trailer != 188)
|
|
{
|
|
int length = array.Length;
|
|
IDigest digest2 = this.digest;
|
|
int length2 = this.block.Length;
|
|
int num = this.trailer;
|
|
int length3 = this.block.Length;
|
|
int num2 = this.trailer;
|
|
int num3 = length3 - 1;
|
|
}
|
|
int length4 = array.Length;
|
|
IDigest digest3 = this.digest;
|
|
int num4 = this.block.Length - 1;
|
|
byte[] array2 = this.block;
|
|
if (num4 != 0)
|
|
{
|
|
byte[] array3 = this.block;
|
|
while (num4 != array3.Length)
|
|
{
|
|
}
|
|
}
|
|
byte[] array4 = this.block;
|
|
}
|
|
|
|
// Token: 0x060095D8 RID: 38360 RVA: 0x00213A88 File Offset: 0x00211C88
|
|
[Token(Token = "0x60095D8")]
|
|
[Address(RVA = "0x1E4F040", Offset = "0x1E4DA40", VA = "0x181E4F040", Slot = "17")]
|
|
public virtual bool VerifySignature(byte[] signature)
|
|
{
|
|
IAsymmetricBlockCipher asymmetricBlockCipher = this.cipher;
|
|
int length = signature.Length;
|
|
this.block = length;
|
|
BigInteger bigInteger;
|
|
if (bigInteger.IntValue == 12 || this.kParam.modulus.Subtract(bigInteger).IntValue != 12)
|
|
{
|
|
}
|
|
this.CreateSignatureBlock();
|
|
byte[] array = BigIntegers.AsUnsignedByteArray(this.block.Length, bigInteger);
|
|
bool flag = Arrays.ConstantTimeAreEqual(this.block, array);
|
|
byte[] array2 = this.block;
|
|
int length2 = array2.Length;
|
|
int num = 0;
|
|
Array.Clear(array2, num, length2);
|
|
int length3 = array.Length;
|
|
int num2 = 0;
|
|
Array.Clear(array, num2, length3);
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x040062E0 RID: 25312
|
|
[Token(Token = "0x40062E0")]
|
|
[Obsolete]
|
|
public const int TRAILER_IMPLICIT = 188;
|
|
|
|
// Token: 0x040062E1 RID: 25313
|
|
[Token(Token = "0x40062E1")]
|
|
[Obsolete]
|
|
public const int TRAILER_RIPEMD160 = 12748;
|
|
|
|
// Token: 0x040062E2 RID: 25314
|
|
[Token(Token = "0x40062E2")]
|
|
[Obsolete]
|
|
public const int TRAILER_RIPEMD128 = 13004;
|
|
|
|
// Token: 0x040062E3 RID: 25315
|
|
[Token(Token = "0x40062E3")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA1 = 13260;
|
|
|
|
// Token: 0x040062E4 RID: 25316
|
|
[Token(Token = "0x40062E4")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA256 = 13516;
|
|
|
|
// Token: 0x040062E5 RID: 25317
|
|
[Token(Token = "0x40062E5")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA512 = 13772;
|
|
|
|
// Token: 0x040062E6 RID: 25318
|
|
[Token(Token = "0x40062E6")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA384 = 14028;
|
|
|
|
// Token: 0x040062E7 RID: 25319
|
|
[Token(Token = "0x40062E7")]
|
|
[Obsolete]
|
|
public const int TRAILER_WHIRLPOOL = 14284;
|
|
|
|
// Token: 0x040062E8 RID: 25320
|
|
[Token(Token = "0x40062E8")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA224 = 14540;
|
|
|
|
// Token: 0x040062E9 RID: 25321
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40062E9")]
|
|
private IDigest digest;
|
|
|
|
// Token: 0x040062EA RID: 25322
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40062EA")]
|
|
private IAsymmetricBlockCipher cipher;
|
|
|
|
// Token: 0x040062EB RID: 25323
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40062EB")]
|
|
private RsaKeyParameters kParam;
|
|
|
|
// Token: 0x040062EC RID: 25324
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40062EC")]
|
|
private int trailer;
|
|
|
|
// Token: 0x040062ED RID: 25325
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x2C")]
|
|
[Token(Token = "0x40062ED")]
|
|
private int keyBits;
|
|
|
|
// Token: 0x040062EE RID: 25326
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40062EE")]
|
|
private byte[] block;
|
|
}
|
|
}
|