Files
Apr2020-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Signers/RsaDigestSigner.cs
T
niko 8fc35183db a
2026-04-11 22:19:20 +02:00

274 lines
17 KiB
C#

using System;
using System.Collections;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Nist;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.TeleTrust;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers
{
// Token: 0x02001BBA RID: 7098
[Token(Token = "0x2001BBA")]
public class RsaDigestSigner : ISigner
{
// Token: 0x0600B183 RID: 45443 RVA: 0x0026A440 File Offset: 0x00268640
[Token(Token = "0x600B183")]
[Address(RVA = "0x18A1500", Offset = "0x18A0300", VA = "0x1818A1500")]
static RsaDigestSigner()
{
IDictionary dictionary = RsaDigestSigner.oidMap;
DerObjectIdentifier ripeMD = TeleTrusTObjectIdentifiers.RipeMD128;
IDictionary dictionary2 = RsaDigestSigner.oidMap;
DerObjectIdentifier ripeMD2 = TeleTrusTObjectIdentifiers.RipeMD160;
IDictionary dictionary3 = RsaDigestSigner.oidMap;
DerObjectIdentifier ripeMD3 = TeleTrusTObjectIdentifiers.RipeMD256;
IDictionary dictionary4 = RsaDigestSigner.oidMap;
DerObjectIdentifier idSha = X509ObjectIdentifiers.IdSha1;
IDictionary dictionary5 = RsaDigestSigner.oidMap;
DerObjectIdentifier idSha2 = NistObjectIdentifiers.IdSha224;
IDictionary dictionary6 = RsaDigestSigner.oidMap;
DerObjectIdentifier idSha3 = NistObjectIdentifiers.IdSha256;
IDictionary dictionary7 = RsaDigestSigner.oidMap;
DerObjectIdentifier idSha4 = NistObjectIdentifiers.IdSha384;
IDictionary dictionary8 = RsaDigestSigner.oidMap;
DerObjectIdentifier idSha5 = NistObjectIdentifiers.IdSha512;
IDictionary dictionary9 = RsaDigestSigner.oidMap;
DerObjectIdentifier md = PkcsObjectIdentifiers.MD2;
IDictionary dictionary10 = RsaDigestSigner.oidMap;
DerObjectIdentifier md2 = PkcsObjectIdentifiers.MD4;
IDictionary dictionary11 = RsaDigestSigner.oidMap;
DerObjectIdentifier md3 = PkcsObjectIdentifiers.MD5;
}
// Token: 0x0600B184 RID: 45444 RVA: 0x0026A4F8 File Offset: 0x002686F8
[Token(Token = "0x600B184")]
[Address(RVA = "0x18A1BD0", Offset = "0x18A09D0", VA = "0x1818A1BD0")]
public RsaDigestSigner(IDigest digest)
{
IDictionary dictionary = RsaDigestSigner.oidMap;
IDictionary dictionary2 = RsaDigestSigner.oidMap;
RsaCoreEngine rsaCoreEngine = new RsaCoreEngine();
}
// Token: 0x0600B185 RID: 45445 RVA: 0x0026A524 File Offset: 0x00268724
[Token(Token = "0x600B185")]
[Address(RVA = "0x18A1DB0", Offset = "0x18A0BB0", VA = "0x1818A1DB0")]
public RsaDigestSigner(IDigest digest, DerObjectIdentifier digestOid)
{
DerNull instance = DerNull.Instance;
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(digestOid, instance);
RsaCoreEngine rsaCoreEngine = new RsaCoreEngine();
}
// Token: 0x0600B186 RID: 45446 RVA: 0x0026A548 File Offset: 0x00268748
[Token(Token = "0x600B186")]
[Address(RVA = "0x18A19B0", Offset = "0x18A07B0", VA = "0x1818A19B0")]
public RsaDigestSigner(IDigest digest, AlgorithmIdentifier algId)
{
RsaCoreEngine rsaCoreEngine = new RsaCoreEngine();
}
// Token: 0x0600B187 RID: 45447 RVA: 0x0026A55C File Offset: 0x0026875C
[Token(Token = "0x600B187")]
[Address(RVA = "0x18A1B00", Offset = "0x18A0900", VA = "0x1818A1B00")]
public RsaDigestSigner(IRsa rsa, IDigest digest, DerObjectIdentifier digestOid)
{
DerNull instance = DerNull.Instance;
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(digestOid, instance);
}
// Token: 0x0600B188 RID: 45448 RVA: 0x0026A578 File Offset: 0x00268778
[Token(Token = "0x600B188")]
[Address(RVA = "0x18A1A30", Offset = "0x18A0830", VA = "0x1818A1A30")]
public RsaDigestSigner(IRsa rsa, IDigest digest, AlgorithmIdentifier algId)
{
RsaBlindedEngine rsaBlindedEngine = new RsaBlindedEngine(rsa);
int num = 0;
int num2 = 0;
base.FieldGetter(num2, num, algId);
Pkcs1Encoding pkcs1Encoding = new Pkcs1Encoding(rsaBlindedEngine);
this.rsaEngine = pkcs1Encoding;
this.algId = algId;
this.digest = digest;
}
// Token: 0x0600B189 RID: 45449 RVA: 0x0026A5B8 File Offset: 0x002687B8
[Token(Token = "0x600B189")]
[Address(RVA = "0x18A1920", Offset = "0x18A0720", VA = "0x1818A1920")]
public RsaDigestSigner(IAsymmetricBlockCipher rsaEngine, IDigest digest, AlgorithmIdentifier algId)
{
Pkcs1Encoding pkcs1Encoding = new Pkcs1Encoding(rsaEngine);
this.rsaEngine = pkcs1Encoding;
this.digest = digest;
this.algId = algId;
}
// Token: 0x17001BED RID: 7149
// (get) Token: 0x0600B18A RID: 45450 RVA: 0x0026A5E8 File Offset: 0x002687E8
[Token(Token = "0x17001BED")]
public virtual string AlgorithmName
{
[Token(Token = "0x600B18A")]
[Address(RVA = "0x18A1EB0", Offset = "0x18A0CB0", VA = "0x1818A1EB0", Slot = "11")]
get
{
IDigest digest = this.digest;
return 0 + "withRSA";
}
}
// Token: 0x0600B18B RID: 45451 RVA: 0x0026A610 File Offset: 0x00268810
[Token(Token = "0x600B18B")]
[Address(RVA = "0x18A0EE0", Offset = "0x189FCE0", VA = "0x1818A0EE0", Slot = "12")]
public virtual void Init(bool forSigning, ICipherParameters parameters)
{
/*
An exception occurred when decompiling this method (0600B18B)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.RsaDigestSigner::Init(System.Boolean,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_4C:
stloc:InvalidKeyException(var_8_56, newobj:InvalidKeyException(InvalidKeyException::.ctor, ldstr:string("Signing requires private key.")))
stloc:InvalidKeyException(var_9_62, newobj:InvalidKeyException(InvalidKeyException::.ctor, ldstr:string("Verification requires public key.")))
}
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 1660
*/;
}
// Token: 0x0600B18C RID: 45452 RVA: 0x0026A680 File Offset: 0x00268880
[Token(Token = "0x600B18C")]
[Address(RVA = "0x18A11B0", Offset = "0x189FFB0", VA = "0x1818A11B0", Slot = "13")]
public virtual void Update(byte input)
{
IDigest digest = this.digest;
throw new NullReferenceException();
}
// Token: 0x0600B18D RID: 45453 RVA: 0x0026A69C File Offset: 0x0026889C
[Token(Token = "0x600B18D")]
[Address(RVA = "0x18A0CC0", Offset = "0x189FAC0", VA = "0x1818A0CC0", Slot = "14")]
public virtual void BlockUpdate(byte[] input, int inOff, int length)
{
IDigest digest = this.digest;
}
// Token: 0x0600B18E RID: 45454 RVA: 0x0026A6B8 File Offset: 0x002688B8
[Token(Token = "0x600B18E")]
[Address(RVA = "0x18A0DD0", Offset = "0x189FBD0", VA = "0x1818A0DD0", Slot = "15")]
public virtual byte[] GenerateSignature()
{
/*
An exception occurred when decompiling this method (0600B18E)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.RsaDigestSigner::GenerateSignature()
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_3B:
stloc:InvalidOperationException(var_8_45, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("RsaDigestSigner 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.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 1660
*/;
}
// Token: 0x0600B18F RID: 45455 RVA: 0x0026A70C File Offset: 0x0026890C
[Token(Token = "0x600B18F")]
[Address(RVA = "0x18A1210", Offset = "0x18A0010", VA = "0x1818A1210", Slot = "16")]
public virtual bool VerifySignature(byte[] signature)
{
/*
An exception occurred when decompiling this method (0600B18F)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Signers.RsaDigestSigner::VerifySignature(System.Byte[])
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_6A:
stloc:InvalidOperationException(var_10_74, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("RsaDigestSigner 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 1660
*/;
}
// Token: 0x0600B190 RID: 45456 RVA: 0x0026A790 File Offset: 0x00268990
[Token(Token = "0x600B190")]
[Address(RVA = "0x18A1160", Offset = "0x189FF60", VA = "0x1818A1160", Slot = "17")]
public virtual void Reset()
{
IDigest digest = this.digest;
throw new NullReferenceException();
}
// Token: 0x0600B191 RID: 45457 RVA: 0x0026A7AC File Offset: 0x002689AC
[Token(Token = "0x600B191")]
[Address(RVA = "0x18A0D40", Offset = "0x189FB40", VA = "0x1818A0D40")]
private byte[] DerEncode(byte[] hash)
{
AlgorithmIdentifier algorithmIdentifier = this.algId;
if (algorithmIdentifier != 0)
{
return new DigestInfo(algorithmIdentifier, hash).GetDerEncoded();
}
return hash;
}
// Token: 0x04007116 RID: 28950
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4007116")]
private readonly IAsymmetricBlockCipher rsaEngine;
// Token: 0x04007117 RID: 28951
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4007117")]
private readonly AlgorithmIdentifier algId;
// Token: 0x04007118 RID: 28952
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4007118")]
private readonly IDigest digest;
// Token: 0x04007119 RID: 28953
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007119")]
private bool forSigning;
// Token: 0x0400711A RID: 28954
[Token(Token = "0x400711A")]
private static readonly IDictionary oidMap = Platform.CreateHashtable();
}
}