371 lines
16 KiB
C#
371 lines
16 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
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: 0x0200175C RID: 5980
|
|
[Token(Token = "0x200175C")]
|
|
[StructLayout(3)]
|
|
internal class CmsEnvelopedHelper
|
|
{
|
|
// Token: 0x0600A180 RID: 41344 RVA: 0x00259210 File Offset: 0x00257410
|
|
[Token(Token = "0x600A180")]
|
|
[Address(RVA = "0x1C78B60", Offset = "0x1C77560", VA = "0x181C78B60")]
|
|
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: 0x0600A181 RID: 41345 RVA: 0x00259280 File Offset: 0x00257480
|
|
[Token(Token = "0x600A181")]
|
|
[Address(RVA = "0x1C78500", Offset = "0x1C76F00", VA = "0x181C78500")]
|
|
private string GetAsymmetricEncryptionAlgName(string encryptionAlgOid)
|
|
{
|
|
bool flag = PkcsObjectIdentifiers.RsaEncryption.identifier.Equals(encryptionAlgOid);
|
|
return encryptionAlgOid;
|
|
}
|
|
|
|
// Token: 0x0600A182 RID: 41346 RVA: 0x002592A8 File Offset: 0x002574A8
|
|
[Token(Token = "0x600A182")]
|
|
[Address(RVA = "0x1C78350", Offset = "0x1C76D50", VA = "0x181C78350")]
|
|
internal IBufferedCipher CreateAsymmetricCipher(string encryptionOid)
|
|
{
|
|
string asymmetricEncryptionAlgName = this.GetAsymmetricEncryptionAlgName(encryptionOid);
|
|
if (!asymmetricEncryptionAlgName.Equals(encryptionOid))
|
|
{
|
|
return CipherUtilities.GetCipher(asymmetricEncryptionAlgName);
|
|
}
|
|
return CipherUtilities.GetCipher(encryptionOid);
|
|
}
|
|
|
|
// Token: 0x0600A183 RID: 41347 RVA: 0x002592DC File Offset: 0x002574DC
|
|
[Token(Token = "0x600A183")]
|
|
[Address(RVA = "0x1C78440", Offset = "0x1C76E40", VA = "0x181C78440")]
|
|
internal IWrapper CreateWrapper(string encryptionOid)
|
|
{
|
|
IWrapper wrapper = WrapperUtilities.GetWrapper(encryptionOid);
|
|
string text;
|
|
return WrapperUtilities.GetWrapper(text);
|
|
}
|
|
|
|
// Token: 0x0600A184 RID: 41348 RVA: 0x002592F8 File Offset: 0x002574F8
|
|
[Token(Token = "0x600A184")]
|
|
[Address(RVA = "0x1C786E0", Offset = "0x1C770E0", VA = "0x181C786E0")]
|
|
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: 0x0600A185 RID: 41349 RVA: 0x00259330 File Offset: 0x00257530
|
|
[Token(Token = "0x600A185")]
|
|
[Address(RVA = "0x1C78590", Offset = "0x1C76F90", VA = "0x181C78590")]
|
|
internal int GetKeySize(string oid)
|
|
{
|
|
IDictionary keySizes = CmsEnvelopedHelper.KeySizes;
|
|
IDictionary keySizes2 = CmsEnvelopedHelper.KeySizes;
|
|
CmsEnvelopedHelper instance = CmsEnvelopedHelper.Instance;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600A186 RID: 41350 RVA: 0x00259370 File Offset: 0x00257570
|
|
[Token(Token = "0x600A186")]
|
|
[Address(RVA = "0x1C78230", Offset = "0x1C76C30", VA = "0x181C78230")]
|
|
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: 0x0600A187 RID: 41351 RVA: 0x002593AC File Offset: 0x002575AC
|
|
[Token(Token = "0x600A187")]
|
|
[Address(RVA = "0x1C78820", Offset = "0x1C77220", VA = "0x181C78820")]
|
|
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: 0x0600A188 RID: 41352 RVA: 0x002593F8 File Offset: 0x002575F8
|
|
[Token(Token = "0x600A188")]
|
|
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
|
public CmsEnvelopedHelper()
|
|
{
|
|
}
|
|
|
|
// Token: 0x04006A5E RID: 27230
|
|
[Token(Token = "0x4006A5E")]
|
|
internal static readonly CmsEnvelopedHelper Instance = new CmsEnvelopedHelper();
|
|
|
|
// Token: 0x04006A5F RID: 27231
|
|
[Token(Token = "0x4006A5F")]
|
|
private static readonly IDictionary KeySizes;
|
|
|
|
// Token: 0x04006A60 RID: 27232
|
|
[Token(Token = "0x4006A60")]
|
|
private static readonly IDictionary BaseCipherNames;
|
|
|
|
// Token: 0x0200175D RID: 5981
|
|
[Token(Token = "0x200175D")]
|
|
internal class CmsAuthenticatedSecureReadable : CmsSecureReadable
|
|
{
|
|
// Token: 0x0600A189 RID: 41353 RVA: 0x0025940C File Offset: 0x0025760C
|
|
[Token(Token = "0x600A189")]
|
|
[Address(RVA = "0x1C73DE0", Offset = "0x1C727E0", VA = "0x181C73DE0")]
|
|
internal CmsAuthenticatedSecureReadable(AlgorithmIdentifier algorithm, CmsReadable readable)
|
|
{
|
|
this.algorithm = algorithm;
|
|
this.readable = readable;
|
|
}
|
|
|
|
// Token: 0x17001955 RID: 6485
|
|
// (get) Token: 0x0600A18A RID: 41354 RVA: 0x00259430 File Offset: 0x00257630
|
|
[Token(Token = "0x17001955")]
|
|
public AlgorithmIdentifier Algorithm
|
|
{
|
|
[Token(Token = "0x600A18A")]
|
|
[Address(RVA = "0x3C39A0", Offset = "0x3C23A0", VA = "0x1803C39A0", Slot = "4")]
|
|
get
|
|
{
|
|
return this.algorithm;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001956 RID: 6486
|
|
// (get) Token: 0x0600A18B RID: 41355 RVA: 0x00259444 File Offset: 0x00257644
|
|
[Token(Token = "0x17001956")]
|
|
public object CryptoObject
|
|
{
|
|
[Token(Token = "0x600A18B")]
|
|
[Address(RVA = "0x3C1240", Offset = "0x3BFC40", VA = "0x1803C1240", Slot = "5")]
|
|
get
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600A18B)
|
|
|
|
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: 0x0600A18C RID: 41356 RVA: 0x00259458 File Offset: 0x00257658
|
|
[Token(Token = "0x600A18C")]
|
|
[Address(RVA = "0x1C73BA0", Offset = "0x1C725A0", VA = "0x181C73BA0", 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: 0x04006A61 RID: 27233
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006A61")]
|
|
private AlgorithmIdentifier algorithm;
|
|
|
|
// Token: 0x04006A62 RID: 27234
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006A62")]
|
|
private IMac mac;
|
|
|
|
// Token: 0x04006A63 RID: 27235
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006A63")]
|
|
private CmsReadable readable;
|
|
}
|
|
|
|
// Token: 0x0200175E RID: 5982
|
|
[Token(Token = "0x200175E")]
|
|
internal class CmsEnvelopedSecureReadable : CmsSecureReadable
|
|
{
|
|
// Token: 0x0600A18D RID: 41357 RVA: 0x002594A8 File Offset: 0x002576A8
|
|
[Token(Token = "0x600A18D")]
|
|
[Address(RVA = "0x1C73DE0", Offset = "0x1C727E0", VA = "0x181C73DE0")]
|
|
internal CmsEnvelopedSecureReadable(AlgorithmIdentifier algorithm, CmsReadable readable)
|
|
{
|
|
this.algorithm = algorithm;
|
|
this.readable = readable;
|
|
}
|
|
|
|
// Token: 0x17001957 RID: 6487
|
|
// (get) Token: 0x0600A18E RID: 41358 RVA: 0x002594CC File Offset: 0x002576CC
|
|
[Token(Token = "0x17001957")]
|
|
public AlgorithmIdentifier Algorithm
|
|
{
|
|
[Token(Token = "0x600A18E")]
|
|
[Address(RVA = "0x3C39A0", Offset = "0x3C23A0", VA = "0x1803C39A0", Slot = "4")]
|
|
get
|
|
{
|
|
return this.algorithm;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001958 RID: 6488
|
|
// (get) Token: 0x0600A18F RID: 41359 RVA: 0x002594E0 File Offset: 0x002576E0
|
|
[Token(Token = "0x17001958")]
|
|
public object CryptoObject
|
|
{
|
|
[Token(Token = "0x600A18F")]
|
|
[Address(RVA = "0x3C1240", Offset = "0x3BFC40", VA = "0x1803C1240", Slot = "5")]
|
|
get
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600A18F)
|
|
|
|
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: 0x0600A190 RID: 41360 RVA: 0x002594F4 File Offset: 0x002576F4
|
|
[Token(Token = "0x600A190")]
|
|
[Address(RVA = "0x1C78EE0", Offset = "0x1C778E0", VA = "0x181C78EE0", 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: 0x04006A64 RID: 27236
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006A64")]
|
|
private AlgorithmIdentifier algorithm;
|
|
|
|
// Token: 0x04006A65 RID: 27237
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006A65")]
|
|
private IBufferedCipher cipher;
|
|
|
|
// Token: 0x04006A66 RID: 27238
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006A66")]
|
|
private CmsReadable readable;
|
|
}
|
|
}
|
|
}
|