Files
27Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Signers/RsaDigestSigner.cs
T
niko c12fbe3fc6 m
2026-04-12 16:51:38 +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: 0x02001C9A RID: 7322
[Token(Token = "0x2001C9A")]
public class RsaDigestSigner : ISigner
{
// Token: 0x0600B551 RID: 46417 RVA: 0x00273604 File Offset: 0x00271804
[Token(Token = "0x600B551")]
[Address(RVA = "0x2365360", Offset = "0x2364360", VA = "0x182365360")]
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: 0x0600B552 RID: 46418 RVA: 0x002736BC File Offset: 0x002718BC
[Token(Token = "0x600B552")]
[Address(RVA = "0x2365A30", Offset = "0x2364A30", VA = "0x182365A30")]
public RsaDigestSigner(IDigest digest)
{
IDictionary dictionary = RsaDigestSigner.oidMap;
IDictionary dictionary2 = RsaDigestSigner.oidMap;
RsaCoreEngine rsaCoreEngine = new RsaCoreEngine();
}
// Token: 0x0600B553 RID: 46419 RVA: 0x002736E8 File Offset: 0x002718E8
[Token(Token = "0x600B553")]
[Address(RVA = "0x2365C10", Offset = "0x2364C10", VA = "0x182365C10")]
public RsaDigestSigner(IDigest digest, DerObjectIdentifier digestOid)
{
DerNull instance = DerNull.Instance;
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(digestOid, instance);
RsaCoreEngine rsaCoreEngine = new RsaCoreEngine();
}
// Token: 0x0600B554 RID: 46420 RVA: 0x0027370C File Offset: 0x0027190C
[Token(Token = "0x600B554")]
[Address(RVA = "0x2365810", Offset = "0x2364810", VA = "0x182365810")]
public RsaDigestSigner(IDigest digest, AlgorithmIdentifier algId)
{
RsaCoreEngine rsaCoreEngine = new RsaCoreEngine();
}
// Token: 0x0600B555 RID: 46421 RVA: 0x00273720 File Offset: 0x00271920
[Token(Token = "0x600B555")]
[Address(RVA = "0x2365960", Offset = "0x2364960", VA = "0x182365960")]
public RsaDigestSigner(IRsa rsa, IDigest digest, DerObjectIdentifier digestOid)
{
DerNull instance = DerNull.Instance;
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(digestOid, instance);
}
// Token: 0x0600B556 RID: 46422 RVA: 0x0027373C File Offset: 0x0027193C
[Token(Token = "0x600B556")]
[Address(RVA = "0x2365890", Offset = "0x2364890", VA = "0x182365890")]
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: 0x0600B557 RID: 46423 RVA: 0x0027377C File Offset: 0x0027197C
[Token(Token = "0x600B557")]
[Address(RVA = "0x2365780", Offset = "0x2364780", VA = "0x182365780")]
public RsaDigestSigner(IAsymmetricBlockCipher rsaEngine, IDigest digest, AlgorithmIdentifier algId)
{
Pkcs1Encoding pkcs1Encoding = new Pkcs1Encoding(rsaEngine);
this.rsaEngine = pkcs1Encoding;
this.digest = digest;
this.algId = algId;
}
// Token: 0x17001C8A RID: 7306
// (get) Token: 0x0600B558 RID: 46424 RVA: 0x002737AC File Offset: 0x002719AC
[Token(Token = "0x17001C8A")]
public virtual string AlgorithmName
{
[Token(Token = "0x600B558")]
[Address(RVA = "0x2365D10", Offset = "0x2364D10", VA = "0x182365D10", Slot = "11")]
get
{
IDigest digest = this.digest;
return 0 + "withRSA";
}
}
// Token: 0x0600B559 RID: 46425 RVA: 0x002737D4 File Offset: 0x002719D4
[Token(Token = "0x600B559")]
[Address(RVA = "0x2364D40", Offset = "0x2363D40", VA = "0x182364D40", Slot = "12")]
public virtual void Init(bool forSigning, ICipherParameters parameters)
{
/*
An exception occurred when decompiling this method (0600B559)
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 1663
*/;
}
// Token: 0x0600B55A RID: 46426 RVA: 0x00273844 File Offset: 0x00271A44
[Token(Token = "0x600B55A")]
[Address(RVA = "0x2365010", Offset = "0x2364010", VA = "0x182365010", Slot = "13")]
public virtual void Update(byte input)
{
IDigest digest = this.digest;
throw new NullReferenceException();
}
// Token: 0x0600B55B RID: 46427 RVA: 0x00273860 File Offset: 0x00271A60
[Token(Token = "0x600B55B")]
[Address(RVA = "0x2364B20", Offset = "0x2363B20", VA = "0x182364B20", Slot = "14")]
public virtual void BlockUpdate(byte[] input, int inOff, int length)
{
IDigest digest = this.digest;
}
// Token: 0x0600B55C RID: 46428 RVA: 0x0027387C File Offset: 0x00271A7C
[Token(Token = "0x600B55C")]
[Address(RVA = "0x2364C30", Offset = "0x2363C30", VA = "0x182364C30", Slot = "15")]
public virtual byte[] GenerateSignature()
{
/*
An exception occurred when decompiling this method (0600B55C)
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 1663
*/;
}
// Token: 0x0600B55D RID: 46429 RVA: 0x002738D0 File Offset: 0x00271AD0
[Token(Token = "0x600B55D")]
[Address(RVA = "0x2365070", Offset = "0x2364070", VA = "0x182365070", Slot = "16")]
public virtual bool VerifySignature(byte[] signature)
{
/*
An exception occurred when decompiling this method (0600B55D)
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 1663
*/;
}
// Token: 0x0600B55E RID: 46430 RVA: 0x00273954 File Offset: 0x00271B54
[Token(Token = "0x600B55E")]
[Address(RVA = "0x2364FC0", Offset = "0x2363FC0", VA = "0x182364FC0", Slot = "17")]
public virtual void Reset()
{
IDigest digest = this.digest;
throw new NullReferenceException();
}
// Token: 0x0600B55F RID: 46431 RVA: 0x00273970 File Offset: 0x00271B70
[Token(Token = "0x600B55F")]
[Address(RVA = "0x2364BA0", Offset = "0x2363BA0", VA = "0x182364BA0")]
private byte[] DerEncode(byte[] hash)
{
AlgorithmIdentifier algorithmIdentifier = this.algId;
if (algorithmIdentifier != 0)
{
return new DigestInfo(algorithmIdentifier, hash).GetDerEncoded();
}
return hash;
}
// Token: 0x040072CF RID: 29391
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40072CF")]
private readonly IAsymmetricBlockCipher rsaEngine;
// Token: 0x040072D0 RID: 29392
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40072D0")]
private readonly AlgorithmIdentifier algId;
// Token: 0x040072D1 RID: 29393
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40072D1")]
private readonly IDigest digest;
// Token: 0x040072D2 RID: 29394
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x40072D2")]
private bool forSigning;
// Token: 0x040072D3 RID: 29395
[Token(Token = "0x40072D3")]
private static readonly IDictionary oidMap = Platform.CreateHashtable();
}
}