scripts
This commit is contained in:
+278
@@ -0,0 +1,278 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC.Multiplier;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers
|
||||
{
|
||||
// Token: 0x020015C6 RID: 5574
|
||||
[Token(Token = "0x20015C6")]
|
||||
[StructLayout(3)]
|
||||
public class ECDsaSigner : IDsaExt, IDsa
|
||||
{
|
||||
// Token: 0x060094F5 RID: 38133 RVA: 0x0020F270 File Offset: 0x0020D470
|
||||
[Token(Token = "0x60094F5")]
|
||||
[Address(RVA = "0x1E3C5E0", Offset = "0x1E3AFE0", VA = "0x181E3C5E0")]
|
||||
public ECDsaSigner()
|
||||
{
|
||||
RandomDsaKCalculator randomDsaKCalculator = new RandomDsaKCalculator();
|
||||
this.kCalculator = randomDsaKCalculator;
|
||||
}
|
||||
|
||||
// Token: 0x060094F6 RID: 38134 RVA: 0x0020F290 File Offset: 0x0020D490
|
||||
[Token(Token = "0x60094F6")]
|
||||
[Address(RVA = "0x3C3A30", Offset = "0x3C2430", VA = "0x1803C3A30")]
|
||||
public ECDsaSigner(IDsaKCalculator kCalculator)
|
||||
{
|
||||
this.kCalculator = kCalculator;
|
||||
}
|
||||
|
||||
// Token: 0x170017D7 RID: 6103
|
||||
// (get) Token: 0x060094F7 RID: 38135 RVA: 0x0020F2AC File Offset: 0x0020D4AC
|
||||
[Token(Token = "0x170017D7")]
|
||||
public virtual string AlgorithmName
|
||||
{
|
||||
[Token(Token = "0x60094F7")]
|
||||
[Address(RVA = "0x1E3C640", Offset = "0x1E3B040", VA = "0x181E3C640", Slot = "9")]
|
||||
get
|
||||
{
|
||||
return "ECDSA";
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060094F8 RID: 38136 RVA: 0x0020F2C0 File Offset: 0x0020D4C0
|
||||
[Token(Token = "0x60094F8")]
|
||||
[Address(RVA = "0x1E3BEB0", Offset = "0x1E3A8B0", VA = "0x181E3BEB0", Slot = "10")]
|
||||
public virtual void Init(bool forSigning, ICipherParameters parameters)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (060094F8)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.ECDsaSigner::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_75:
|
||||
stloc:InvalidKeyException(var_11_7F, newobj:InvalidKeyException(InvalidKeyException::.ctor, ldstr:string("EC public key required 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: 0x170017D8 RID: 6104
|
||||
// (get) Token: 0x060094F9 RID: 38137 RVA: 0x0020F350 File Offset: 0x0020D550
|
||||
[Token(Token = "0x170017D8")]
|
||||
public virtual BigInteger Order
|
||||
{
|
||||
[Token(Token = "0x60094F9")]
|
||||
[Address(RVA = "0x1E3C670", Offset = "0x1E3B070", VA = "0x181E3C670", Slot = "11")]
|
||||
get
|
||||
{
|
||||
return this.key.parameters.n;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060094FA RID: 38138 RVA: 0x0020F374 File Offset: 0x0020D574
|
||||
[Token(Token = "0x60094FA")]
|
||||
[Address(RVA = "0x1E3B8F0", Offset = "0x1E3A2F0", VA = "0x181E3B8F0", Slot = "12")]
|
||||
public virtual BigInteger[] GenerateSignature(byte[] message)
|
||||
{
|
||||
BigInteger n;
|
||||
ECKeyParameters eckeyParameters;
|
||||
do
|
||||
{
|
||||
n = this.key.parameters.n;
|
||||
eckeyParameters = this.key;
|
||||
}
|
||||
while (eckeyParameters == 0 || eckeyParameters == 0);
|
||||
IDsaKCalculator dsaKCalculator = this.kCalculator;
|
||||
IDsaKCalculator dsaKCalculator2 = this.kCalculator;
|
||||
if (eckeyParameters == 0)
|
||||
{
|
||||
SecureRandom secureRandom = this.random;
|
||||
}
|
||||
int num = 0;
|
||||
IDsaKCalculator dsaKCalculator3 = this.kCalculator;
|
||||
if (num < dsaKCalculator2)
|
||||
{
|
||||
num += num;
|
||||
num++;
|
||||
}
|
||||
uint num2;
|
||||
if (num < (int)num2)
|
||||
{
|
||||
num += num;
|
||||
num++;
|
||||
}
|
||||
char c;
|
||||
string text = c.ToString();
|
||||
BigInteger bigInteger;
|
||||
while (bigInteger.sign == 0)
|
||||
{
|
||||
}
|
||||
BigInteger bigInteger3;
|
||||
BigInteger bigInteger4;
|
||||
BigInteger bigInteger2 = bigInteger3.Multiply(bigInteger4).Mod(n);
|
||||
while (bigInteger2.sign == 0)
|
||||
{
|
||||
}
|
||||
return new BigInteger[] { bigInteger, bigInteger2 };
|
||||
}
|
||||
|
||||
// Token: 0x060094FB RID: 38139 RVA: 0x0020F448 File Offset: 0x0020D648
|
||||
[Token(Token = "0x60094FB")]
|
||||
[Address(RVA = "0x1E3C190", Offset = "0x1E3AB90", VA = "0x181E3C190", Slot = "13")]
|
||||
public virtual bool VerifySignature(byte[] message, BigInteger r, BigInteger s)
|
||||
{
|
||||
BigInteger n = this.key.parameters.n;
|
||||
int num = r.CompareTo(n);
|
||||
int num2 = s.CompareTo(n);
|
||||
BigInteger bigInteger = s.ModInverse(n);
|
||||
BigInteger bigInteger3;
|
||||
BigInteger bigInteger2 = bigInteger3.Mod(n);
|
||||
BigInteger bigInteger4 = r.Multiply(bigInteger);
|
||||
int num3 = 0;
|
||||
BigInteger bigInteger5 = bigInteger4.Mod(n);
|
||||
ECPoint ecpoint = ECAlgorithms.SumOfTwoMultiplies(this.key.parameters.g, bigInteger2, num3, bigInteger5);
|
||||
if (!ecpoint.IsInfinity)
|
||||
{
|
||||
bool flag = ecpoint.SatisfiesOrder();
|
||||
if (flag && flag)
|
||||
{
|
||||
BigInteger eight = ECDsaSigner.Eight;
|
||||
ECMultiplier ecmultiplier = this.CreateBasePointMultiplier();
|
||||
if (ecmultiplier != 0 && ecmultiplier == 0)
|
||||
{
|
||||
ECFieldElement affineYCoord = ecpoint.AffineYCoord;
|
||||
if (flag.GetTypeCode() != TypeCode.Empty)
|
||||
{
|
||||
int num4 = flag.CompareTo(r);
|
||||
bool flag2;
|
||||
if (!flag2)
|
||||
{
|
||||
BigInteger bigInteger6 = r.Add(n);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
goto IL_DD;
|
||||
}
|
||||
}
|
||||
bool flag3 = ecpoint.IsNormalized();
|
||||
sbyte b;
|
||||
string text = b.ToString();
|
||||
}
|
||||
IL_DD:
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x060094FC RID: 38140 RVA: 0x0020F538 File Offset: 0x0020D738
|
||||
[Token(Token = "0x60094FC")]
|
||||
[Address(RVA = "0x1E3B7E0", Offset = "0x1E3A1E0", VA = "0x181E3B7E0", Slot = "14")]
|
||||
protected virtual BigInteger CalculateE(BigInteger n, byte[] message)
|
||||
{
|
||||
int num = message.Length;
|
||||
BigInteger bigInteger = new BigInteger(1, message);
|
||||
if (n.BitLength < num)
|
||||
{
|
||||
int bitLength = n.BitLength;
|
||||
num -= bitLength;
|
||||
BigInteger bigInteger2 = bigInteger.ShiftRight(num);
|
||||
}
|
||||
return bigInteger;
|
||||
}
|
||||
|
||||
// Token: 0x060094FD RID: 38141 RVA: 0x0020F578 File Offset: 0x0020D778
|
||||
[Token(Token = "0x60094FD")]
|
||||
[Address(RVA = "0x1E3B8A0", Offset = "0x1E3A2A0", VA = "0x181E3B8A0", Slot = "15")]
|
||||
protected virtual ECMultiplier CreateBasePointMultiplier()
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (060094FD)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Math.EC.Multiplier.ECMultiplier BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.ECDsaSigner::CreateBasePointMultiplier()
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
Block_0:
|
||||
stloc:FixedPointCombMultiplier(var_0_05, newobj:FixedPointCombMultiplier(FixedPointCombMultiplier::.ctor))
|
||||
}
|
||||
|
||||
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: 0x060094FE RID: 38142 RVA: 0x0020F58C File Offset: 0x0020D78C
|
||||
[Token(Token = "0x60094FE")]
|
||||
[Address(RVA = "0x1E3BD90", Offset = "0x1E3A790", VA = "0x181E3BD90", Slot = "16")]
|
||||
protected virtual ECFieldElement GetDenominator(int coordinateSystem, ECPoint p)
|
||||
{
|
||||
if (coordinateSystem <= 6)
|
||||
{
|
||||
BigInteger bigInteger = p.YCoord.ToBigInteger();
|
||||
bool flag = p.SatisfiesCurveEquation();
|
||||
}
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x060094FF RID: 38143 RVA: 0x0020F5B8 File Offset: 0x0020D7B8
|
||||
[Token(Token = "0x60094FF")]
|
||||
[Address(RVA = "0x1E3BE40", Offset = "0x1E3A840", VA = "0x181E3BE40", Slot = "17")]
|
||||
protected virtual SecureRandom InitSecureRandom(bool needed, SecureRandom provided)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (!needed)
|
||||
{
|
||||
}
|
||||
}
|
||||
while (provided != 0);
|
||||
return new SecureRandom();
|
||||
}
|
||||
|
||||
// Token: 0x06009500 RID: 38144 RVA: 0x0020F5D4 File Offset: 0x0020D7D4
|
||||
// Note: this type is marked as 'beforefieldinit'.
|
||||
[Token(Token = "0x6009500")]
|
||||
[Address(RVA = "0x1E3C580", Offset = "0x1E3AF80", VA = "0x181E3C580")]
|
||||
static ECDsaSigner()
|
||||
{
|
||||
BigInteger bigInteger;
|
||||
ECDsaSigner.Eight = bigInteger;
|
||||
}
|
||||
|
||||
// Token: 0x0400625C RID: 25180
|
||||
[Token(Token = "0x400625C")]
|
||||
private static readonly BigInteger Eight;
|
||||
|
||||
// Token: 0x0400625D RID: 25181
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x400625D")]
|
||||
protected readonly IDsaKCalculator kCalculator;
|
||||
|
||||
// Token: 0x0400625E RID: 25182
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x400625E")]
|
||||
protected ECKeyParameters key;
|
||||
|
||||
// Token: 0x0400625F RID: 25183
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x400625F")]
|
||||
protected SecureRandom random;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user