302 lines
15 KiB
C#
302 lines
15 KiB
C#
using System;
|
|
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: 0x02001BBD RID: 7101
|
|
[Token(Token = "0x2001BBD")]
|
|
public class X931Signer : ISigner
|
|
{
|
|
// Token: 0x0600B1A8 RID: 45480 RVA: 0x0026AE0C File Offset: 0x0026900C
|
|
[Token(Token = "0x600B1A8")]
|
|
[Address(RVA = "0x18A6A30", Offset = "0x18A5830", VA = "0x1818A6A30")]
|
|
public X931Signer(IAsymmetricBlockCipher cipher, IDigest digest, bool isImplicit)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B1A8)
|
|
|
|
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: 0x17001BEF RID: 7151
|
|
// (get) Token: 0x0600B1A9 RID: 45481 RVA: 0x0026AE68 File Offset: 0x00269068
|
|
[Token(Token = "0x17001BEF")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B1A9")]
|
|
[Address(RVA = "0x18A6B30", Offset = "0x18A5930", VA = "0x1818A6B30", Slot = "11")]
|
|
get
|
|
{
|
|
IDigest digest = this.digest;
|
|
IAsymmetricBlockCipher asymmetricBlockCipher = this.cipher;
|
|
string text;
|
|
return text;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B1AA RID: 45482 RVA: 0x0026AE90 File Offset: 0x00269090
|
|
[Token(Token = "0x600B1AA")]
|
|
[Address(RVA = "0x18A6940", Offset = "0x18A5740", VA = "0x1818A6940")]
|
|
public X931Signer(IAsymmetricBlockCipher cipher, IDigest digest)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B1AA)
|
|
|
|
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: 0x0600B1AB RID: 45483 RVA: 0x0026AED8 File Offset: 0x002690D8
|
|
[Token(Token = "0x600B1AB")]
|
|
[Address(RVA = "0x18A6580", Offset = "0x18A5380", VA = "0x1818A6580", 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: 0x0600B1AC RID: 45484 RVA: 0x0026AF40 File Offset: 0x00269140
|
|
[Token(Token = "0x600B1AC")]
|
|
[Address(RVA = "0x189B390", Offset = "0x189A190", VA = "0x18189B390")]
|
|
private void ClearBlock(byte[] block)
|
|
{
|
|
int length = block.Length;
|
|
int num = 0;
|
|
Array.Clear(block, num, length);
|
|
}
|
|
|
|
// Token: 0x0600B1AD RID: 45485 RVA: 0x0026AF64 File Offset: 0x00269164
|
|
[Token(Token = "0x600B1AD")]
|
|
[Address(RVA = "0x18A66E0", Offset = "0x18A54E0", VA = "0x1818A66E0", Slot = "13")]
|
|
public virtual void Update(byte b)
|
|
{
|
|
IDigest digest = this.digest;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B1AE RID: 45486 RVA: 0x0026AF80 File Offset: 0x00269180
|
|
[Token(Token = "0x600B1AE")]
|
|
[Address(RVA = "0x18A61E0", Offset = "0x18A4FE0", VA = "0x1818A61E0", Slot = "14")]
|
|
public virtual void BlockUpdate(byte[] input, int off, int len)
|
|
{
|
|
IDigest digest = this.digest;
|
|
}
|
|
|
|
// Token: 0x0600B1AF RID: 45487 RVA: 0x0026AF9C File Offset: 0x0026919C
|
|
[Token(Token = "0x600B1AF")]
|
|
[Address(RVA = "0x18A6690", Offset = "0x18A5490", VA = "0x1818A6690", Slot = "15")]
|
|
public virtual void Reset()
|
|
{
|
|
IDigest digest = this.digest;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B1B0 RID: 45488 RVA: 0x0026AFB8 File Offset: 0x002691B8
|
|
[Token(Token = "0x600B1B0")]
|
|
[Address(RVA = "0x18A6460", Offset = "0x18A5260", VA = "0x1818A6460", 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: 0x0600B1B1 RID: 45489 RVA: 0x0026B03C File Offset: 0x0026923C
|
|
[Token(Token = "0x600B1B1")]
|
|
[Address(RVA = "0x18A6260", Offset = "0x18A5060", VA = "0x1818A6260")]
|
|
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: 0x0600B1B2 RID: 45490 RVA: 0x0026B0F4 File Offset: 0x002692F4
|
|
[Token(Token = "0x600B1B2")]
|
|
[Address(RVA = "0x18A6740", Offset = "0x18A5540", VA = "0x1818A6740", 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: 0x04007123 RID: 28963
|
|
[Token(Token = "0x4007123")]
|
|
[Obsolete]
|
|
public const int TRAILER_IMPLICIT = 188;
|
|
|
|
// Token: 0x04007124 RID: 28964
|
|
[Token(Token = "0x4007124")]
|
|
[Obsolete]
|
|
public const int TRAILER_RIPEMD160 = 12748;
|
|
|
|
// Token: 0x04007125 RID: 28965
|
|
[Token(Token = "0x4007125")]
|
|
[Obsolete]
|
|
public const int TRAILER_RIPEMD128 = 13004;
|
|
|
|
// Token: 0x04007126 RID: 28966
|
|
[Token(Token = "0x4007126")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA1 = 13260;
|
|
|
|
// Token: 0x04007127 RID: 28967
|
|
[Token(Token = "0x4007127")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA256 = 13516;
|
|
|
|
// Token: 0x04007128 RID: 28968
|
|
[Token(Token = "0x4007128")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA512 = 13772;
|
|
|
|
// Token: 0x04007129 RID: 28969
|
|
[Token(Token = "0x4007129")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA384 = 14028;
|
|
|
|
// Token: 0x0400712A RID: 28970
|
|
[Token(Token = "0x400712A")]
|
|
[Obsolete]
|
|
public const int TRAILER_WHIRLPOOL = 14284;
|
|
|
|
// Token: 0x0400712B RID: 28971
|
|
[Token(Token = "0x400712B")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA224 = 14540;
|
|
|
|
// Token: 0x0400712C RID: 28972
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400712C")]
|
|
private IDigest digest;
|
|
|
|
// Token: 0x0400712D RID: 28973
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400712D")]
|
|
private IAsymmetricBlockCipher cipher;
|
|
|
|
// Token: 0x0400712E RID: 28974
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400712E")]
|
|
private RsaKeyParameters kParam;
|
|
|
|
// Token: 0x0400712F RID: 28975
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400712F")]
|
|
private int trailer;
|
|
|
|
// Token: 0x04007130 RID: 28976
|
|
[FieldOffset(Offset = "0x2C")]
|
|
[Token(Token = "0x4007130")]
|
|
private int keyBits;
|
|
|
|
// Token: 0x04007131 RID: 28977
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007131")]
|
|
private byte[] block;
|
|
}
|
|
}
|