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: 0x02001D4E RID: 7502
|
|
[Token(Token = "0x2001D4E")]
|
|
internal class CmsSignedHelper
|
|
{
|
|
// Token: 0x0600BE10 RID: 48656 RVA: 0x002B45A0 File Offset: 0x002B27A0
|
|
[Token(Token = "0x600BE10")]
|
|
[Address(RVA = "0x2001CF0", Offset = "0x2000AF0", VA = "0x182001CF0")]
|
|
private static void AddEntries(DerObjectIdentifier oid, string digest, string encryption)
|
|
{
|
|
IDictionary dictionary = CmsSignedHelper.digestAlgs;
|
|
IDictionary dictionary2 = CmsSignedHelper.encryptionAlgs;
|
|
}
|
|
|
|
// Token: 0x0600BE11 RID: 48657 RVA: 0x002B45C0 File Offset: 0x002B27C0
|
|
[Token(Token = "0x600BE11")]
|
|
[Address(RVA = "0x2002FE0", Offset = "0x2001DE0", VA = "0x182002FE0")]
|
|
static CmsSignedHelper()
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BE11)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600BE12 RID: 48658 RVA: 0x002B4ADC File Offset: 0x002B2CDC
|
|
[Token(Token = "0x600BE12")]
|
|
[Address(RVA = "0x2002420", Offset = "0x2001220", VA = "0x182002420")]
|
|
internal string GetDigestAlgName(string digestAlgOid)
|
|
{
|
|
IDictionary dictionary = CmsSignedHelper.digestAlgs;
|
|
return digestAlgOid;
|
|
}
|
|
|
|
// Token: 0x0600BE13 RID: 48659 RVA: 0x002B4AF8 File Offset: 0x002B2CF8
|
|
[Token(Token = "0x600BE13")]
|
|
[Address(RVA = "0x20026E0", Offset = "0x20014E0", VA = "0x1820026E0")]
|
|
internal AlgorithmIdentifier GetEncAlgorithmIdentifier(DerObjectIdentifier encOid, Asn1Encodable sigX509Parameters)
|
|
{
|
|
ISet set = CmsSignedHelper.noParams;
|
|
return new AlgorithmIdentifier(encOid, sigX509Parameters);
|
|
}
|
|
|
|
// Token: 0x0600BE14 RID: 48660 RVA: 0x002B4B20 File Offset: 0x002B2D20
|
|
[Token(Token = "0x600BE14")]
|
|
[Address(RVA = "0x20024D0", Offset = "0x20012D0", VA = "0x1820024D0")]
|
|
internal string[] GetDigestAliases(string algName)
|
|
{
|
|
IDictionary dictionary = CmsSignedHelper.digestAliases;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600BE15 RID: 48661 RVA: 0x002B4B38 File Offset: 0x002B2D38
|
|
[Token(Token = "0x600BE15")]
|
|
[Address(RVA = "0x2002ED0", Offset = "0x2001CD0", VA = "0x182002ED0")]
|
|
internal string GetEncryptionAlgName(string encryptionAlgOid)
|
|
{
|
|
IDictionary dictionary = CmsSignedHelper.encryptionAlgs;
|
|
return encryptionAlgOid;
|
|
}
|
|
|
|
// Token: 0x0600BE16 RID: 48662 RVA: 0x002B4B54 File Offset: 0x002B2D54
|
|
[Token(Token = "0x600BE16")]
|
|
[Address(RVA = "0x20025D0", Offset = "0x20013D0", VA = "0x1820025D0")]
|
|
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: 0x0600BE17 RID: 48663 RVA: 0x002B4B88 File Offset: 0x002B2D88
|
|
[Token(Token = "0x600BE17")]
|
|
[Address(RVA = "0x2002F80", Offset = "0x2001D80", VA = "0x182002F80")]
|
|
internal ISigner GetSignatureInstance(string algorithm)
|
|
{
|
|
return SignerUtilities.GetSigner(algorithm);
|
|
}
|
|
|
|
// Token: 0x0600BE18 RID: 48664 RVA: 0x002B4B9C File Offset: 0x002B2D9C
|
|
[Token(Token = "0x600BE18")]
|
|
[Address(RVA = "0x2001DD0", Offset = "0x2000BD0", VA = "0x182001DD0")]
|
|
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: 0x0600BE19 RID: 48665 RVA: 0x002B4C3C File Offset: 0x002B2E3C
|
|
[Token(Token = "0x600BE19")]
|
|
[Address(RVA = "0x2002100", Offset = "0x2000F00", VA = "0x182002100")]
|
|
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: 0x0600BE1A RID: 48666 RVA: 0x002B4C88 File Offset: 0x002B2E88
|
|
[Token(Token = "0x600BE1A")]
|
|
[Address(RVA = "0x2002220", Offset = "0x2001020", VA = "0x182002220")]
|
|
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: 0x0600BE1B RID: 48667 RVA: 0x002B4CD4 File Offset: 0x002B2ED4
|
|
[Token(Token = "0x600BE1B")]
|
|
[Address(RVA = "0x2001880", Offset = "0x2000680", VA = "0x182001880")]
|
|
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: 0x0600BE1C RID: 48668 RVA: 0x002B4D2C File Offset: 0x002B2F2C
|
|
[Token(Token = "0x600BE1C")]
|
|
[Address(RVA = "0x2001AD0", Offset = "0x20008D0", VA = "0x182001AD0")]
|
|
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: 0x0600BE1D RID: 48669 RVA: 0x002B4D80 File Offset: 0x002B2F80
|
|
[Token(Token = "0x600BE1D")]
|
|
[Address(RVA = "0x2002340", Offset = "0x2001140", VA = "0x182002340")]
|
|
internal AlgorithmIdentifier FixAlgID(AlgorithmIdentifier algId)
|
|
{
|
|
if (algId.ObjectID != 0)
|
|
{
|
|
return algId;
|
|
}
|
|
Asn1Object asn1Object = algId.ToAsn1Object();
|
|
AlgorithmIdentifier algorithmIdentifier;
|
|
return algorithmIdentifier;
|
|
}
|
|
|
|
// Token: 0x0600BE1E RID: 48670 RVA: 0x002B4DA8 File Offset: 0x002B2FA8
|
|
[Token(Token = "0x600BE1E")]
|
|
[Address(RVA = "0x20027D0", Offset = "0x20015D0", VA = "0x1820027D0")]
|
|
internal string GetEncOid(AsymmetricKeyParameter key, string digestOID)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BE1E)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600BE1F RID: 48671 RVA: 0x002B4EA8 File Offset: 0x002B30A8
|
|
[Token(Token = "0x600BE1F")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
public CmsSignedHelper()
|
|
{
|
|
}
|
|
|
|
// Token: 0x04007904 RID: 30980
|
|
[Token(Token = "0x4007904")]
|
|
internal static readonly CmsSignedHelper Instance;
|
|
|
|
// Token: 0x04007905 RID: 30981
|
|
[Token(Token = "0x4007905")]
|
|
private static readonly string EncryptionECDsaWithSha1;
|
|
|
|
// Token: 0x04007906 RID: 30982
|
|
[Token(Token = "0x4007906")]
|
|
private static readonly string EncryptionECDsaWithSha224;
|
|
|
|
// Token: 0x04007907 RID: 30983
|
|
[Token(Token = "0x4007907")]
|
|
private static readonly string EncryptionECDsaWithSha256;
|
|
|
|
// Token: 0x04007908 RID: 30984
|
|
[Token(Token = "0x4007908")]
|
|
private static readonly string EncryptionECDsaWithSha384;
|
|
|
|
// Token: 0x04007909 RID: 30985
|
|
[Token(Token = "0x4007909")]
|
|
private static readonly string EncryptionECDsaWithSha512;
|
|
|
|
// Token: 0x0400790A RID: 30986
|
|
[Token(Token = "0x400790A")]
|
|
private static readonly IDictionary encryptionAlgs;
|
|
|
|
// Token: 0x0400790B RID: 30987
|
|
[Token(Token = "0x400790B")]
|
|
private static readonly IDictionary digestAlgs;
|
|
|
|
// Token: 0x0400790C RID: 30988
|
|
[Token(Token = "0x400790C")]
|
|
private static readonly IDictionary digestAliases;
|
|
|
|
// Token: 0x0400790D RID: 30989
|
|
[Token(Token = "0x400790D")]
|
|
private static readonly ISet noParams;
|
|
|
|
// Token: 0x0400790E RID: 30990
|
|
[Token(Token = "0x400790E")]
|
|
private static readonly IDictionary ecAlgorithms;
|
|
}
|
|
}
|