355 lines
15 KiB
C#
355 lines
15 KiB
C#
using System;
|
|
using System.Collections;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Store;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cms
|
|
{
|
|
// Token: 0x02001E2E RID: 7726
|
|
[Token(Token = "0x2001E2E")]
|
|
internal class CmsSignedHelper
|
|
{
|
|
// Token: 0x0600C1DE RID: 49630 RVA: 0x002BCE98 File Offset: 0x002BB098
|
|
[Token(Token = "0x600C1DE")]
|
|
[Address(RVA = "0x2925470", Offset = "0x2924470", VA = "0x182925470")]
|
|
private static void AddEntries(DerObjectIdentifier oid, string digest, string encryption)
|
|
{
|
|
IDictionary dictionary = CmsSignedHelper.digestAlgs;
|
|
IDictionary dictionary2 = CmsSignedHelper.encryptionAlgs;
|
|
}
|
|
|
|
// Token: 0x0600C1DF RID: 49631 RVA: 0x002BCEB8 File Offset: 0x002BB0B8
|
|
[Token(Token = "0x600C1DF")]
|
|
[Address(RVA = "0x2926760", Offset = "0x2925760", VA = "0x182926760")]
|
|
static CmsSignedHelper()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600C1DF)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.CmsSignedHelper::.cctor()
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_4D1:
|
|
stelem:string([mscorlib]System.String, ldloc:string[](var_77_4C7), ldc.i4:int32(0), ldstr:string("SHA-512"))
|
|
stloc:ISet(var_78_4E3, ldsfld:ISet(CmsSignedHelper::noParams))
|
|
stloc:ISet(var_79_4EA, ldsfld:ISet(CmsSignedHelper::noParams))
|
|
stloc:ISet(var_80_4F1, ldsfld:ISet(CmsSignedHelper::noParams))
|
|
stloc:ISet(var_81_4F8, ldsfld:ISet(CmsSignedHelper::noParams))
|
|
stloc:ISet(var_82_4FF, ldsfld:ISet(CmsSignedHelper::noParams))
|
|
stloc:ISet(var_83_506, ldsfld:ISet(CmsSignedHelper::noParams))
|
|
stloc:IDictionary(var_84_50D, ldsfld:IDictionary(CmsSignedHelper::ecAlgorithms))
|
|
}
|
|
|
|
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: 0x0600C1E0 RID: 49632 RVA: 0x002BD3D4 File Offset: 0x002BB5D4
|
|
[Token(Token = "0x600C1E0")]
|
|
[Address(RVA = "0x2925BA0", Offset = "0x2924BA0", VA = "0x182925BA0")]
|
|
internal string GetDigestAlgName(string digestAlgOid)
|
|
{
|
|
IDictionary dictionary = CmsSignedHelper.digestAlgs;
|
|
return digestAlgOid;
|
|
}
|
|
|
|
// Token: 0x0600C1E1 RID: 49633 RVA: 0x002BD3F0 File Offset: 0x002BB5F0
|
|
[Token(Token = "0x600C1E1")]
|
|
[Address(RVA = "0x2925E60", Offset = "0x2924E60", VA = "0x182925E60")]
|
|
internal AlgorithmIdentifier GetEncAlgorithmIdentifier(DerObjectIdentifier encOid, Asn1Encodable sigX509Parameters)
|
|
{
|
|
ISet set = CmsSignedHelper.noParams;
|
|
return new AlgorithmIdentifier(encOid, sigX509Parameters);
|
|
}
|
|
|
|
// Token: 0x0600C1E2 RID: 49634 RVA: 0x002BD418 File Offset: 0x002BB618
|
|
[Token(Token = "0x600C1E2")]
|
|
[Address(RVA = "0x2925C50", Offset = "0x2924C50", VA = "0x182925C50")]
|
|
internal string[] GetDigestAliases(string algName)
|
|
{
|
|
IDictionary dictionary = CmsSignedHelper.digestAliases;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600C1E3 RID: 49635 RVA: 0x002BD430 File Offset: 0x002BB630
|
|
[Token(Token = "0x600C1E3")]
|
|
[Address(RVA = "0x2926650", Offset = "0x2925650", VA = "0x182926650")]
|
|
internal string GetEncryptionAlgName(string encryptionAlgOid)
|
|
{
|
|
IDictionary dictionary = CmsSignedHelper.encryptionAlgs;
|
|
return encryptionAlgOid;
|
|
}
|
|
|
|
// Token: 0x0600C1E4 RID: 49636 RVA: 0x002BD44C File Offset: 0x002BB64C
|
|
[Token(Token = "0x600C1E4")]
|
|
[Address(RVA = "0x2925D50", Offset = "0x2924D50", VA = "0x182925D50")]
|
|
internal IDigest GetDigestInstance(string algorithm)
|
|
{
|
|
int num;
|
|
string[] array;
|
|
do
|
|
{
|
|
IDigest digest = DigestUtilities.GetDigest(algorithm);
|
|
num = 0;
|
|
}
|
|
while (num >= array.Length);
|
|
return DigestUtilities.GetDigest(array[num]);
|
|
}
|
|
|
|
// Token: 0x0600C1E5 RID: 49637 RVA: 0x002BD480 File Offset: 0x002BB680
|
|
[Token(Token = "0x600C1E5")]
|
|
[Address(RVA = "0x2926700", Offset = "0x2925700", VA = "0x182926700")]
|
|
internal ISigner GetSignatureInstance(string algorithm)
|
|
{
|
|
return SignerUtilities.GetSigner(algorithm);
|
|
}
|
|
|
|
// Token: 0x0600C1E6 RID: 49638 RVA: 0x002BD494 File Offset: 0x002BB694
|
|
[Token(Token = "0x600C1E6")]
|
|
[Address(RVA = "0x2925550", Offset = "0x2924550", VA = "0x182925550")]
|
|
internal IX509Store CreateAttributeStore(string type, Asn1Set certSet)
|
|
{
|
|
IList list;
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
list = Platform.CreateArrayList();
|
|
if (certSet == 0)
|
|
{
|
|
break;
|
|
}
|
|
IEnumerator enumerator = certSet.GetEnumerator();
|
|
if (enumerator != 0)
|
|
{
|
|
if (enumerator == 0)
|
|
{
|
|
}
|
|
if (enumerator == 0)
|
|
{
|
|
goto IL_8D;
|
|
}
|
|
Asn1Sequence asn1Sequence;
|
|
if (new X509V2AttributeCertificate(asn1Sequence.GetEncoded()) != 0)
|
|
{
|
|
}
|
|
if (num == 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
string text = "AttributeCertificate/" + type;
|
|
X509CollectionStoreParameters x509CollectionStoreParameters = new X509CollectionStoreParameters(list);
|
|
return X509StoreFactory.Create(text, x509CollectionStoreParameters);
|
|
IL_8D:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600C1E7 RID: 49639 RVA: 0x002BD534 File Offset: 0x002BB734
|
|
[Token(Token = "0x600C1E7")]
|
|
[Address(RVA = "0x2925880", Offset = "0x2924880", VA = "0x182925880")]
|
|
internal IX509Store CreateCertificateStore(string type, Asn1Set certSet)
|
|
{
|
|
IList list = Platform.CreateArrayList();
|
|
if (certSet != 0)
|
|
{
|
|
this.AddCertsFromSet(list, certSet);
|
|
}
|
|
string text = "Certificate/" + type;
|
|
X509CollectionStoreParameters x509CollectionStoreParameters = new X509CollectionStoreParameters(list);
|
|
return X509StoreFactory.Create(text, x509CollectionStoreParameters);
|
|
}
|
|
|
|
// Token: 0x0600C1E8 RID: 49640 RVA: 0x002BD580 File Offset: 0x002BB780
|
|
[Token(Token = "0x600C1E8")]
|
|
[Address(RVA = "0x29259A0", Offset = "0x29249A0", VA = "0x1829259A0")]
|
|
internal IX509Store CreateCrlStore(string type, Asn1Set crlSet)
|
|
{
|
|
IList list = Platform.CreateArrayList();
|
|
if (crlSet != 0)
|
|
{
|
|
this.AddCrlsFromSet(list, crlSet);
|
|
}
|
|
string text = "CRL/" + type;
|
|
X509CollectionStoreParameters x509CollectionStoreParameters = new X509CollectionStoreParameters(list);
|
|
return X509StoreFactory.Create(text, x509CollectionStoreParameters);
|
|
}
|
|
|
|
// Token: 0x0600C1E9 RID: 49641 RVA: 0x002BD5CC File Offset: 0x002BB7CC
|
|
[Token(Token = "0x600C1E9")]
|
|
[Address(RVA = "0x2925000", Offset = "0x2924000", VA = "0x182925000")]
|
|
private void AddCertsFromSet(IList certs, Asn1Set certSet)
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
X509CertificateParser x509CertificateParser = new X509CertificateParser();
|
|
IEnumerator enumerator = certSet.GetEnumerator();
|
|
if (enumerator != 0)
|
|
{
|
|
if (enumerator == 0)
|
|
{
|
|
}
|
|
if (enumerator == 0)
|
|
{
|
|
goto IL_45;
|
|
}
|
|
byte[] array;
|
|
if (x509CertificateParser.ReadCertificate(array) != 0)
|
|
{
|
|
}
|
|
if (num == 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
IL_45:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600C1EA RID: 49642 RVA: 0x002BD624 File Offset: 0x002BB824
|
|
[Token(Token = "0x600C1EA")]
|
|
[Address(RVA = "0x2925250", Offset = "0x2924250", VA = "0x182925250")]
|
|
private void AddCrlsFromSet(IList crls, Asn1Set crlSet)
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
X509CrlParser x509CrlParser = new X509CrlParser();
|
|
IEnumerator enumerator = crlSet.GetEnumerator();
|
|
if (enumerator != 0)
|
|
{
|
|
if (enumerator == 0)
|
|
{
|
|
}
|
|
if (enumerator == 0)
|
|
{
|
|
goto IL_3F;
|
|
}
|
|
byte[] array;
|
|
if (x509CrlParser.ReadCrl(array) != 0)
|
|
{
|
|
}
|
|
if (num == 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return;
|
|
IL_3F:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600C1EB RID: 49643 RVA: 0x002BD678 File Offset: 0x002BB878
|
|
[Token(Token = "0x600C1EB")]
|
|
[Address(RVA = "0x2925AC0", Offset = "0x2924AC0", VA = "0x182925AC0")]
|
|
internal AlgorithmIdentifier FixAlgID(AlgorithmIdentifier algId)
|
|
{
|
|
if (algId.ObjectID != 0)
|
|
{
|
|
return algId;
|
|
}
|
|
Asn1Object asn1Object = algId.ToAsn1Object();
|
|
AlgorithmIdentifier algorithmIdentifier;
|
|
return algorithmIdentifier;
|
|
}
|
|
|
|
// Token: 0x0600C1EC RID: 49644 RVA: 0x002BD6A0 File Offset: 0x002BB8A0
|
|
[Token(Token = "0x600C1EC")]
|
|
[Address(RVA = "0x2925F50", Offset = "0x2924F50", VA = "0x182925F50")]
|
|
internal string GetEncOid(AsymmetricKeyParameter key, string digestOID)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600C1EC)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.String BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.CmsSignedHelper::GetEncOid(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.AsymmetricKeyParameter,System.String)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_E8:
|
|
stloc:ArgumentException(var_21_F2, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Unknown algorithm in CmsSignedGenerator.GetEncOid")))
|
|
}
|
|
|
|
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: 0x0600C1ED RID: 49645 RVA: 0x002BD7A0 File Offset: 0x002BB9A0
|
|
[Token(Token = "0x600C1ED")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
public CmsSignedHelper()
|
|
{
|
|
}
|
|
|
|
// Token: 0x04007ABD RID: 31421
|
|
[Token(Token = "0x4007ABD")]
|
|
internal static readonly CmsSignedHelper Instance;
|
|
|
|
// Token: 0x04007ABE RID: 31422
|
|
[Token(Token = "0x4007ABE")]
|
|
private static readonly string EncryptionECDsaWithSha1;
|
|
|
|
// Token: 0x04007ABF RID: 31423
|
|
[Token(Token = "0x4007ABF")]
|
|
private static readonly string EncryptionECDsaWithSha224;
|
|
|
|
// Token: 0x04007AC0 RID: 31424
|
|
[Token(Token = "0x4007AC0")]
|
|
private static readonly string EncryptionECDsaWithSha256;
|
|
|
|
// Token: 0x04007AC1 RID: 31425
|
|
[Token(Token = "0x4007AC1")]
|
|
private static readonly string EncryptionECDsaWithSha384;
|
|
|
|
// Token: 0x04007AC2 RID: 31426
|
|
[Token(Token = "0x4007AC2")]
|
|
private static readonly string EncryptionECDsaWithSha512;
|
|
|
|
// Token: 0x04007AC3 RID: 31427
|
|
[Token(Token = "0x4007AC3")]
|
|
private static readonly IDictionary encryptionAlgs;
|
|
|
|
// Token: 0x04007AC4 RID: 31428
|
|
[Token(Token = "0x4007AC4")]
|
|
private static readonly IDictionary digestAlgs;
|
|
|
|
// Token: 0x04007AC5 RID: 31429
|
|
[Token(Token = "0x4007AC5")]
|
|
private static readonly IDictionary digestAliases;
|
|
|
|
// Token: 0x04007AC6 RID: 31430
|
|
[Token(Token = "0x4007AC6")]
|
|
private static readonly ISet noParams;
|
|
|
|
// Token: 0x04007AC7 RID: 31431
|
|
[Token(Token = "0x4007AC7")]
|
|
private static readonly IDictionary ecAlgorithms;
|
|
}
|
|
}
|