369 lines
16 KiB
C#
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: 0x02001E19 RID: 7705
|
|
[Token(Token = "0x2001E19")]
|
|
internal class CmsEnvelopedHelper
|
|
{
|
|
// Token: 0x0600C128 RID: 49448 RVA: 0x002B9ECC File Offset: 0x002B80CC
|
|
[Token(Token = "0x600C128")]
|
|
[Address(RVA = "0x2147840", Offset = "0x2146840", VA = "0x182147840")]
|
|
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: 0x0600C129 RID: 49449 RVA: 0x002B9F3C File Offset: 0x002B813C
|
|
[Token(Token = "0x600C129")]
|
|
[Address(RVA = "0x21471E0", Offset = "0x21461E0", VA = "0x1821471E0")]
|
|
private string GetAsymmetricEncryptionAlgName(string encryptionAlgOid)
|
|
{
|
|
bool flag = PkcsObjectIdentifiers.RsaEncryption.identifier.Equals(encryptionAlgOid);
|
|
return encryptionAlgOid;
|
|
}
|
|
|
|
// Token: 0x0600C12A RID: 49450 RVA: 0x002B9F64 File Offset: 0x002B8164
|
|
[Token(Token = "0x600C12A")]
|
|
[Address(RVA = "0x2147030", Offset = "0x2146030", VA = "0x182147030")]
|
|
internal IBufferedCipher CreateAsymmetricCipher(string encryptionOid)
|
|
{
|
|
string asymmetricEncryptionAlgName = this.GetAsymmetricEncryptionAlgName(encryptionOid);
|
|
if (!asymmetricEncryptionAlgName.Equals(encryptionOid))
|
|
{
|
|
return CipherUtilities.GetCipher(asymmetricEncryptionAlgName);
|
|
}
|
|
return CipherUtilities.GetCipher(encryptionOid);
|
|
}
|
|
|
|
// Token: 0x0600C12B RID: 49451 RVA: 0x002B9F98 File Offset: 0x002B8198
|
|
[Token(Token = "0x600C12B")]
|
|
[Address(RVA = "0x2147120", Offset = "0x2146120", VA = "0x182147120")]
|
|
internal IWrapper CreateWrapper(string encryptionOid)
|
|
{
|
|
IWrapper wrapper = WrapperUtilities.GetWrapper(encryptionOid);
|
|
string text;
|
|
return WrapperUtilities.GetWrapper(text);
|
|
}
|
|
|
|
// Token: 0x0600C12C RID: 49452 RVA: 0x002B9FB4 File Offset: 0x002B81B4
|
|
[Token(Token = "0x600C12C")]
|
|
[Address(RVA = "0x21473C0", Offset = "0x21463C0", VA = "0x1821473C0")]
|
|
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: 0x0600C12D RID: 49453 RVA: 0x002B9FEC File Offset: 0x002B81EC
|
|
[Token(Token = "0x600C12D")]
|
|
[Address(RVA = "0x2147270", Offset = "0x2146270", VA = "0x182147270")]
|
|
internal int GetKeySize(string oid)
|
|
{
|
|
IDictionary keySizes = CmsEnvelopedHelper.KeySizes;
|
|
IDictionary keySizes2 = CmsEnvelopedHelper.KeySizes;
|
|
CmsEnvelopedHelper instance = CmsEnvelopedHelper.Instance;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600C12E RID: 49454 RVA: 0x002BA02C File Offset: 0x002B822C
|
|
[Token(Token = "0x600C12E")]
|
|
[Address(RVA = "0x2146F10", Offset = "0x2145F10", VA = "0x182146F10")]
|
|
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: 0x0600C12F RID: 49455 RVA: 0x002BA068 File Offset: 0x002B8268
|
|
[Token(Token = "0x600C12F")]
|
|
[Address(RVA = "0x2147500", Offset = "0x2146500", VA = "0x182147500")]
|
|
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: 0x0600C130 RID: 49456 RVA: 0x002BA0B4 File Offset: 0x002B82B4
|
|
[Token(Token = "0x600C130")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
public CmsEnvelopedHelper()
|
|
{
|
|
}
|
|
|
|
// Token: 0x04007A5A RID: 31322
|
|
[Token(Token = "0x4007A5A")]
|
|
internal static readonly CmsEnvelopedHelper Instance = new CmsEnvelopedHelper();
|
|
|
|
// Token: 0x04007A5B RID: 31323
|
|
[Token(Token = "0x4007A5B")]
|
|
private static readonly IDictionary KeySizes;
|
|
|
|
// Token: 0x04007A5C RID: 31324
|
|
[Token(Token = "0x4007A5C")]
|
|
private static readonly IDictionary BaseCipherNames;
|
|
|
|
// Token: 0x02001E1A RID: 7706
|
|
[Token(Token = "0x2001E1A")]
|
|
internal class CmsAuthenticatedSecureReadable : CmsSecureReadable
|
|
{
|
|
// Token: 0x0600C131 RID: 49457 RVA: 0x002BA0C8 File Offset: 0x002B82C8
|
|
[Token(Token = "0x600C131")]
|
|
[Address(RVA = "0x2142CD0", Offset = "0x2141CD0", VA = "0x182142CD0")]
|
|
internal CmsAuthenticatedSecureReadable(AlgorithmIdentifier algorithm, CmsReadable readable)
|
|
{
|
|
this.algorithm = algorithm;
|
|
this.readable = readable;
|
|
}
|
|
|
|
// Token: 0x17001DF3 RID: 7667
|
|
// (get) Token: 0x0600C132 RID: 49458 RVA: 0x002BA0EC File Offset: 0x002B82EC
|
|
[Token(Token = "0x17001DF3")]
|
|
public AlgorithmIdentifier Algorithm
|
|
{
|
|
[Token(Token = "0x600C132")]
|
|
[Address(RVA = "0x411530", Offset = "0x410530", VA = "0x180411530", Slot = "4")]
|
|
get
|
|
{
|
|
return this.algorithm;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001DF4 RID: 7668
|
|
// (get) Token: 0x0600C133 RID: 49459 RVA: 0x002BA100 File Offset: 0x002B8300
|
|
[Token(Token = "0x17001DF4")]
|
|
public object CryptoObject
|
|
{
|
|
[Token(Token = "0x600C133")]
|
|
[Address(RVA = "0x4157B0", Offset = "0x4147B0", VA = "0x1804157B0", Slot = "5")]
|
|
get
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600C133)
|
|
|
|
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: 0x0600C134 RID: 49460 RVA: 0x002BA114 File Offset: 0x002B8314
|
|
[Token(Token = "0x600C134")]
|
|
[Address(RVA = "0x2142A90", Offset = "0x2141A90", VA = "0x182142A90", 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: 0x04007A5D RID: 31325
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007A5D")]
|
|
private AlgorithmIdentifier algorithm;
|
|
|
|
// Token: 0x04007A5E RID: 31326
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007A5E")]
|
|
private IMac mac;
|
|
|
|
// Token: 0x04007A5F RID: 31327
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007A5F")]
|
|
private CmsReadable readable;
|
|
}
|
|
|
|
// Token: 0x02001E1B RID: 7707
|
|
[Token(Token = "0x2001E1B")]
|
|
internal class CmsEnvelopedSecureReadable : CmsSecureReadable
|
|
{
|
|
// Token: 0x0600C135 RID: 49461 RVA: 0x002BA164 File Offset: 0x002B8364
|
|
[Token(Token = "0x600C135")]
|
|
[Address(RVA = "0x2142CD0", Offset = "0x2141CD0", VA = "0x182142CD0")]
|
|
internal CmsEnvelopedSecureReadable(AlgorithmIdentifier algorithm, CmsReadable readable)
|
|
{
|
|
this.algorithm = algorithm;
|
|
this.readable = readable;
|
|
}
|
|
|
|
// Token: 0x17001DF5 RID: 7669
|
|
// (get) Token: 0x0600C136 RID: 49462 RVA: 0x002BA188 File Offset: 0x002B8388
|
|
[Token(Token = "0x17001DF5")]
|
|
public AlgorithmIdentifier Algorithm
|
|
{
|
|
[Token(Token = "0x600C136")]
|
|
[Address(RVA = "0x411530", Offset = "0x410530", VA = "0x180411530", Slot = "4")]
|
|
get
|
|
{
|
|
return this.algorithm;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001DF6 RID: 7670
|
|
// (get) Token: 0x0600C137 RID: 49463 RVA: 0x002BA19C File Offset: 0x002B839C
|
|
[Token(Token = "0x17001DF6")]
|
|
public object CryptoObject
|
|
{
|
|
[Token(Token = "0x600C137")]
|
|
[Address(RVA = "0x4157B0", Offset = "0x4147B0", VA = "0x1804157B0", Slot = "5")]
|
|
get
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600C137)
|
|
|
|
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: 0x0600C138 RID: 49464 RVA: 0x002BA1B0 File Offset: 0x002B83B0
|
|
[Token(Token = "0x600C138")]
|
|
[Address(RVA = "0x2147BC0", Offset = "0x2146BC0", VA = "0x182147BC0", 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: 0x04007A60 RID: 31328
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007A60")]
|
|
private AlgorithmIdentifier algorithm;
|
|
|
|
// Token: 0x04007A61 RID: 31329
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007A61")]
|
|
private IBufferedCipher cipher;
|
|
|
|
// Token: 0x04007A62 RID: 31330
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007A62")]
|
|
private CmsReadable readable;
|
|
}
|
|
}
|
|
}
|