Files
Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Cms/CmsEnvelopedHelper.cs
T
2026-04-10 22:50:51 +02:00

369 lines
16 KiB
C#

using System;
using System.Collections;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IO;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cms
{
// Token: 0x02001D39 RID: 7481
[Token(Token = "0x2001D39")]
internal class CmsEnvelopedHelper
{
// Token: 0x0600BD5A RID: 48474 RVA: 0x002B1664 File Offset: 0x002AF864
[Token(Token = "0x600BD5A")]
[Address(RVA = "0x16661D0", Offset = "0x1664FD0", VA = "0x1816661D0")]
static CmsEnvelopedHelper()
{
IDictionary dictionary = Platform.CreateHashtable();
CmsEnvelopedHelper.KeySizes = dictionary;
CmsEnvelopedHelper.BaseCipherNames = Platform.CreateHashtable();
IDictionary keySizes = CmsEnvelopedHelper.KeySizes;
IDictionary keySizes2 = CmsEnvelopedHelper.KeySizes;
IDictionary keySizes3 = CmsEnvelopedHelper.KeySizes;
IDictionary keySizes4 = CmsEnvelopedHelper.KeySizes;
IDictionary baseCipherNames = CmsEnvelopedHelper.BaseCipherNames;
IDictionary baseCipherNames2 = CmsEnvelopedHelper.BaseCipherNames;
IDictionary baseCipherNames3 = CmsEnvelopedHelper.BaseCipherNames;
IDictionary baseCipherNames4 = CmsEnvelopedHelper.BaseCipherNames;
}
// Token: 0x0600BD5B RID: 48475 RVA: 0x002B16D4 File Offset: 0x002AF8D4
[Token(Token = "0x600BD5B")]
[Address(RVA = "0x1665B70", Offset = "0x1664970", VA = "0x181665B70")]
private string GetAsymmetricEncryptionAlgName(string encryptionAlgOid)
{
bool flag = PkcsObjectIdentifiers.RsaEncryption.identifier.Equals(encryptionAlgOid);
return encryptionAlgOid;
}
// Token: 0x0600BD5C RID: 48476 RVA: 0x002B16FC File Offset: 0x002AF8FC
[Token(Token = "0x600BD5C")]
[Address(RVA = "0x16659C0", Offset = "0x16647C0", VA = "0x1816659C0")]
internal IBufferedCipher CreateAsymmetricCipher(string encryptionOid)
{
string asymmetricEncryptionAlgName = this.GetAsymmetricEncryptionAlgName(encryptionOid);
if (!asymmetricEncryptionAlgName.Equals(encryptionOid))
{
return CipherUtilities.GetCipher(asymmetricEncryptionAlgName);
}
return CipherUtilities.GetCipher(encryptionOid);
}
// Token: 0x0600BD5D RID: 48477 RVA: 0x002B1730 File Offset: 0x002AF930
[Token(Token = "0x600BD5D")]
[Address(RVA = "0x1665AB0", Offset = "0x16648B0", VA = "0x181665AB0")]
internal IWrapper CreateWrapper(string encryptionOid)
{
IWrapper wrapper = WrapperUtilities.GetWrapper(encryptionOid);
string text;
return WrapperUtilities.GetWrapper(text);
}
// Token: 0x0600BD5E RID: 48478 RVA: 0x002B174C File Offset: 0x002AF94C
[Token(Token = "0x600BD5E")]
[Address(RVA = "0x1665D50", Offset = "0x1664B50", VA = "0x181665D50")]
internal string GetRfc3211WrapperName(string oid)
{
if (oid != 0)
{
IDictionary baseCipherNames = CmsEnvelopedHelper.BaseCipherNames;
string text;
return text;
}
ArgumentNullException ex = new ArgumentNullException("oid");
string text2;
ArgumentException ex2 = new ArgumentException(text2, "oid");
throw new NullReferenceException();
}
// Token: 0x0600BD5F RID: 48479 RVA: 0x002B1784 File Offset: 0x002AF984
[Token(Token = "0x600BD5F")]
[Address(RVA = "0x1665C00", Offset = "0x1664A00", VA = "0x181665C00")]
internal int GetKeySize(string oid)
{
IDictionary keySizes = CmsEnvelopedHelper.KeySizes;
IDictionary keySizes2 = CmsEnvelopedHelper.KeySizes;
CmsEnvelopedHelper instance = CmsEnvelopedHelper.Instance;
throw new NullReferenceException();
}
// Token: 0x0600BD60 RID: 48480 RVA: 0x002B17C4 File Offset: 0x002AF9C4
[Token(Token = "0x600BD60")]
[Address(RVA = "0x16658A0", Offset = "0x16646A0", VA = "0x1816658A0")]
internal static RecipientInformationStore BuildRecipientInformationStore(Asn1Set recipientInfos, CmsSecureReadable secureReadable)
{
IList list = Platform.CreateArrayList();
int num = 0;
Asn1Encodable asn1Encodable;
if (num != asn1Encodable)
{
IEnumerator enumerator = recipientInfos.GetEnumerator();
RecipientInfo recipientInfo;
CmsEnvelopedHelper.ReadRecipientInfo(list, recipientInfo, secureReadable);
num++;
}
return new RecipientInformationStore(list);
}
// Token: 0x0600BD61 RID: 48481 RVA: 0x002B1800 File Offset: 0x002AFA00
[Token(Token = "0x600BD61")]
[Address(RVA = "0x1665E90", Offset = "0x1664C90", VA = "0x181665E90")]
private static void ReadRecipientInfo(IList infos, RecipientInfo info, CmsSecureReadable secureReadable)
{
Asn1Encodable info2;
do
{
info2 = info.Info;
if (info2 == 0)
{
break;
}
if (info2 != 0)
{
goto IL_35;
}
if (info2 != 0)
{
goto IL_32;
}
if (info2 != 0)
{
goto IL_2F;
}
}
while (info2 != 0 && info2 == 0);
return;
IL_2F:
IL_32:
IL_35:
throw new NullReferenceException();
}
// Token: 0x0600BD62 RID: 48482 RVA: 0x002B184C File Offset: 0x002AFA4C
[Token(Token = "0x600BD62")]
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
public CmsEnvelopedHelper()
{
}
// Token: 0x040078A1 RID: 30881
[Token(Token = "0x40078A1")]
internal static readonly CmsEnvelopedHelper Instance = new CmsEnvelopedHelper();
// Token: 0x040078A2 RID: 30882
[Token(Token = "0x40078A2")]
private static readonly IDictionary KeySizes;
// Token: 0x040078A3 RID: 30883
[Token(Token = "0x40078A3")]
private static readonly IDictionary BaseCipherNames;
// Token: 0x02001D3A RID: 7482
[Token(Token = "0x2001D3A")]
internal class CmsAuthenticatedSecureReadable : CmsSecureReadable
{
// Token: 0x0600BD63 RID: 48483 RVA: 0x002B1860 File Offset: 0x002AFA60
[Token(Token = "0x600BD63")]
[Address(RVA = "0x1661660", Offset = "0x1660460", VA = "0x181661660")]
internal CmsAuthenticatedSecureReadable(AlgorithmIdentifier algorithm, CmsReadable readable)
{
this.algorithm = algorithm;
this.readable = readable;
}
// Token: 0x17001D56 RID: 7510
// (get) Token: 0x0600BD64 RID: 48484 RVA: 0x002B1884 File Offset: 0x002AFA84
[Token(Token = "0x17001D56")]
public AlgorithmIdentifier Algorithm
{
[Token(Token = "0x600BD64")]
[Address(RVA = "0x3F6E20", Offset = "0x3F5C20", VA = "0x1803F6E20", Slot = "4")]
get
{
return this.algorithm;
}
}
// Token: 0x17001D57 RID: 7511
// (get) Token: 0x0600BD65 RID: 48485 RVA: 0x002B1898 File Offset: 0x002AFA98
[Token(Token = "0x17001D57")]
public object CryptoObject
{
[Token(Token = "0x600BD65")]
[Address(RVA = "0x3F5F40", Offset = "0x3F4D40", VA = "0x1803F5F40", Slot = "5")]
get
{
/*
An exception occurred when decompiling this method (0600BD65)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Object BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.CmsEnvelopedHelper/CmsAuthenticatedSecureReadable::get_CryptoObject()
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:IMac(var_0_06, ldfld:IMac(CmsAuthenticatedSecureReadable::mac, ldloc:CmsAuthenticatedSecureReadable(this)))
}
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: 0x0600BD66 RID: 48486 RVA: 0x002B18AC File Offset: 0x002AFAAC
[Token(Token = "0x600BD66")]
[Address(RVA = "0x1661420", Offset = "0x1660220", VA = "0x181661420", Slot = "6")]
public CmsReadable GetReadable(KeyParameter sKey)
{
Asn1Object asn1Object = this.algorithm.ToAsn1Object();
IMac mac;
this.mac = mac;
CmsReadable cmsReadable = this.readable;
MacSink macSink = new MacSink(this.mac);
CmsProcessableInputStream cmsProcessableInputStream;
TeeInputStream teeInputStream;
cmsProcessableInputStream.input = teeInputStream;
throw new NullReferenceException();
}
// Token: 0x040078A4 RID: 30884
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40078A4")]
private AlgorithmIdentifier algorithm;
// Token: 0x040078A5 RID: 30885
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40078A5")]
private IMac mac;
// Token: 0x040078A6 RID: 30886
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40078A6")]
private CmsReadable readable;
}
// Token: 0x02001D3B RID: 7483
[Token(Token = "0x2001D3B")]
internal class CmsEnvelopedSecureReadable : CmsSecureReadable
{
// Token: 0x0600BD67 RID: 48487 RVA: 0x002B18FC File Offset: 0x002AFAFC
[Token(Token = "0x600BD67")]
[Address(RVA = "0x1661660", Offset = "0x1660460", VA = "0x181661660")]
internal CmsEnvelopedSecureReadable(AlgorithmIdentifier algorithm, CmsReadable readable)
{
this.algorithm = algorithm;
this.readable = readable;
}
// Token: 0x17001D58 RID: 7512
// (get) Token: 0x0600BD68 RID: 48488 RVA: 0x002B1920 File Offset: 0x002AFB20
[Token(Token = "0x17001D58")]
public AlgorithmIdentifier Algorithm
{
[Token(Token = "0x600BD68")]
[Address(RVA = "0x3F6E20", Offset = "0x3F5C20", VA = "0x1803F6E20", Slot = "4")]
get
{
return this.algorithm;
}
}
// Token: 0x17001D59 RID: 7513
// (get) Token: 0x0600BD69 RID: 48489 RVA: 0x002B1934 File Offset: 0x002AFB34
[Token(Token = "0x17001D59")]
public object CryptoObject
{
[Token(Token = "0x600BD69")]
[Address(RVA = "0x3F5F40", Offset = "0x3F4D40", VA = "0x1803F5F40", Slot = "5")]
get
{
/*
An exception occurred when decompiling this method (0600BD69)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Object BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.CmsEnvelopedHelper/CmsEnvelopedSecureReadable::get_CryptoObject()
---> System.Exception: Basic block has to end with unconditional control flow.
{
Block_0:
stloc:IBufferedCipher(var_0_06, ldfld:IBufferedCipher(CmsEnvelopedSecureReadable::cipher, ldloc:CmsEnvelopedSecureReadable(this)))
}
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: 0x0600BD6A RID: 48490 RVA: 0x002B1948 File Offset: 0x002AFB48
[Token(Token = "0x600BD6A")]
[Address(RVA = "0x1666550", Offset = "0x1665350", VA = "0x181666550", Slot = "6")]
public CmsReadable GetReadable(KeyParameter sKey)
{
Asn1Object asn1Object = this.algorithm.ToAsn1Object();
IBufferedCipher bufferedCipher;
this.cipher = bufferedCipher;
DerObjectIdentifier objectID = this.algorithm.ObjectID;
if (objectID == 0)
{
}
Asn1Object asn1Object2 = objectID.ToAsn1Object();
if (asn1Object2 != 0 && asn1Object2 == 0)
{
Asn1Object asn1Object3 = this.algorithm.ToAsn1Object();
}
Asn1Object asn1Object4 = this.algorithm.ToAsn1Object();
string desEde3Cbc = CmsEnvelopedGenerator.DesEde3Cbc;
bool flag;
bool flag2;
bool flag3;
if (flag || flag2 || flag3)
{
byte[] array = new byte[8];
ICipherParameters cipherParameters;
ParametersWithIV parametersWithIV = new ParametersWithIV(cipherParameters, array);
}
IBufferedCipher bufferedCipher2 = this.cipher;
CmsReadable cmsReadable = this.readable;
CmsProcessableInputStream cmsProcessableInputStream;
CipherStream cipherStream;
cmsProcessableInputStream.input = cipherStream;
throw new NullReferenceException();
}
// Token: 0x040078A7 RID: 30887
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40078A7")]
private AlgorithmIdentifier algorithm;
// Token: 0x040078A8 RID: 30888
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40078A8")]
private IBufferedCipher cipher;
// Token: 0x040078A9 RID: 30889
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40078A9")]
private CmsReadable readable;
}
}
}