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: 0x02001C9D RID: 7325
|
|
[Token(Token = "0x2001C9D")]
|
|
public class X931Signer : ISigner
|
|
{
|
|
// Token: 0x0600B576 RID: 46454 RVA: 0x00273FD0 File Offset: 0x002721D0
|
|
[Token(Token = "0x600B576")]
|
|
[Address(RVA = "0x2342960", Offset = "0x2341960", VA = "0x182342960")]
|
|
public X931Signer(IAsymmetricBlockCipher cipher, IDigest digest, bool isImplicit)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B576)
|
|
|
|
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: 0x17001C8C RID: 7308
|
|
// (get) Token: 0x0600B577 RID: 46455 RVA: 0x0027402C File Offset: 0x0027222C
|
|
[Token(Token = "0x17001C8C")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600B577")]
|
|
[Address(RVA = "0x2342A60", Offset = "0x2341A60", VA = "0x182342A60", Slot = "11")]
|
|
get
|
|
{
|
|
IDigest digest = this.digest;
|
|
IAsymmetricBlockCipher asymmetricBlockCipher = this.cipher;
|
|
string text;
|
|
return text;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B578 RID: 46456 RVA: 0x00274054 File Offset: 0x00272254
|
|
[Token(Token = "0x600B578")]
|
|
[Address(RVA = "0x2342870", Offset = "0x2341870", VA = "0x182342870")]
|
|
public X931Signer(IAsymmetricBlockCipher cipher, IDigest digest)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B578)
|
|
|
|
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: 0x0600B579 RID: 46457 RVA: 0x0027409C File Offset: 0x0027229C
|
|
[Token(Token = "0x600B579")]
|
|
[Address(RVA = "0x23424B0", Offset = "0x23414B0", VA = "0x1823424B0", 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: 0x0600B57A RID: 46458 RVA: 0x00274104 File Offset: 0x00272304
|
|
[Token(Token = "0x600B57A")]
|
|
[Address(RVA = "0x2342160", Offset = "0x2341160", VA = "0x182342160")]
|
|
private void ClearBlock(byte[] block)
|
|
{
|
|
int length = block.Length;
|
|
int num = 0;
|
|
Array.Clear(block, num, length);
|
|
}
|
|
|
|
// Token: 0x0600B57B RID: 46459 RVA: 0x00274128 File Offset: 0x00272328
|
|
[Token(Token = "0x600B57B")]
|
|
[Address(RVA = "0x2342610", Offset = "0x2341610", VA = "0x182342610", Slot = "13")]
|
|
public virtual void Update(byte b)
|
|
{
|
|
IDigest digest = this.digest;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B57C RID: 46460 RVA: 0x00274144 File Offset: 0x00272344
|
|
[Token(Token = "0x600B57C")]
|
|
[Address(RVA = "0x23420E0", Offset = "0x23410E0", VA = "0x1823420E0", Slot = "14")]
|
|
public virtual void BlockUpdate(byte[] input, int off, int len)
|
|
{
|
|
IDigest digest = this.digest;
|
|
}
|
|
|
|
// Token: 0x0600B57D RID: 46461 RVA: 0x00274160 File Offset: 0x00272360
|
|
[Token(Token = "0x600B57D")]
|
|
[Address(RVA = "0x23425C0", Offset = "0x23415C0", VA = "0x1823425C0", Slot = "15")]
|
|
public virtual void Reset()
|
|
{
|
|
IDigest digest = this.digest;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600B57E RID: 46462 RVA: 0x0027417C File Offset: 0x0027237C
|
|
[Token(Token = "0x600B57E")]
|
|
[Address(RVA = "0x2342390", Offset = "0x2341390", VA = "0x182342390", 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: 0x0600B57F RID: 46463 RVA: 0x00274200 File Offset: 0x00272400
|
|
[Token(Token = "0x600B57F")]
|
|
[Address(RVA = "0x2342190", Offset = "0x2341190", VA = "0x182342190")]
|
|
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: 0x0600B580 RID: 46464 RVA: 0x002742B8 File Offset: 0x002724B8
|
|
[Token(Token = "0x600B580")]
|
|
[Address(RVA = "0x2342670", Offset = "0x2341670", VA = "0x182342670", 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: 0x040072DC RID: 29404
|
|
[Token(Token = "0x40072DC")]
|
|
[Obsolete]
|
|
public const int TRAILER_IMPLICIT = 188;
|
|
|
|
// Token: 0x040072DD RID: 29405
|
|
[Token(Token = "0x40072DD")]
|
|
[Obsolete]
|
|
public const int TRAILER_RIPEMD160 = 12748;
|
|
|
|
// Token: 0x040072DE RID: 29406
|
|
[Token(Token = "0x40072DE")]
|
|
[Obsolete]
|
|
public const int TRAILER_RIPEMD128 = 13004;
|
|
|
|
// Token: 0x040072DF RID: 29407
|
|
[Token(Token = "0x40072DF")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA1 = 13260;
|
|
|
|
// Token: 0x040072E0 RID: 29408
|
|
[Token(Token = "0x40072E0")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA256 = 13516;
|
|
|
|
// Token: 0x040072E1 RID: 29409
|
|
[Token(Token = "0x40072E1")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA512 = 13772;
|
|
|
|
// Token: 0x040072E2 RID: 29410
|
|
[Token(Token = "0x40072E2")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA384 = 14028;
|
|
|
|
// Token: 0x040072E3 RID: 29411
|
|
[Token(Token = "0x40072E3")]
|
|
[Obsolete]
|
|
public const int TRAILER_WHIRLPOOL = 14284;
|
|
|
|
// Token: 0x040072E4 RID: 29412
|
|
[Token(Token = "0x40072E4")]
|
|
[Obsolete]
|
|
public const int TRAILER_SHA224 = 14540;
|
|
|
|
// Token: 0x040072E5 RID: 29413
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40072E5")]
|
|
private IDigest digest;
|
|
|
|
// Token: 0x040072E6 RID: 29414
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40072E6")]
|
|
private IAsymmetricBlockCipher cipher;
|
|
|
|
// Token: 0x040072E7 RID: 29415
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40072E7")]
|
|
private RsaKeyParameters kParam;
|
|
|
|
// Token: 0x040072E8 RID: 29416
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40072E8")]
|
|
private int trailer;
|
|
|
|
// Token: 0x040072E9 RID: 29417
|
|
[FieldOffset(Offset = "0x2C")]
|
|
[Token(Token = "0x40072E9")]
|
|
private int keyBits;
|
|
|
|
// Token: 0x040072EA RID: 29418
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40072EA")]
|
|
private byte[] block;
|
|
}
|
|
}
|