386 lines
15 KiB
C#
386 lines
15 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Store;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cms
|
|
{
|
|
// Token: 0x02001E24 RID: 7716
|
|
[Token(Token = "0x2001E24")]
|
|
public class CmsSignedData
|
|
{
|
|
// Token: 0x0600C15D RID: 49501 RVA: 0x002BA648 File Offset: 0x002B8848
|
|
[Token(Token = "0x600C15D")]
|
|
[Address(RVA = "0x214CD20", Offset = "0x214BD20", VA = "0x18214CD20")]
|
|
private CmsSignedData(CmsSignedData c)
|
|
{
|
|
SignedData signedData = c.signedData;
|
|
this.signedData = signedData;
|
|
ContentInfo contentInfo = c.contentInfo;
|
|
this.contentInfo = contentInfo;
|
|
CmsProcessable cmsProcessable = c.signedContent;
|
|
this.signedContent = cmsProcessable;
|
|
SignerInformationStore signerInformationStore = c.signerInfoStore;
|
|
this.signerInfoStore = signerInformationStore;
|
|
}
|
|
|
|
// Token: 0x0600C15E RID: 49502 RVA: 0x002BA69C File Offset: 0x002B889C
|
|
[Token(Token = "0x600C15E")]
|
|
[Address(RVA = "0x214CD70", Offset = "0x214BD70", VA = "0x18214CD70")]
|
|
public CmsSignedData(byte[] sigBlock)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(sigBlock, num != 0);
|
|
num = 0;
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(memoryStream);
|
|
}
|
|
|
|
// Token: 0x0600C15F RID: 49503 RVA: 0x002BA6BC File Offset: 0x002B88BC
|
|
[Token(Token = "0x600C15F")]
|
|
[Address(RVA = "0x214CBF0", Offset = "0x214BBF0", VA = "0x18214CBF0")]
|
|
public CmsSignedData(CmsProcessable signedContent, byte[] sigBlock)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(sigBlock, num != 0);
|
|
num = 0;
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(memoryStream);
|
|
}
|
|
|
|
// Token: 0x0600C160 RID: 49504 RVA: 0x002BA6DC File Offset: 0x002B88DC
|
|
[Token(Token = "0x600C160")]
|
|
[Address(RVA = "0x214CC80", Offset = "0x214BC80", VA = "0x18214CC80")]
|
|
public CmsSignedData(IDictionary hashes, byte[] sigBlock)
|
|
{
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(sigBlock);
|
|
base..ctor();
|
|
this.hashes = hashes;
|
|
this.contentInfo = contentInfo;
|
|
SignedData instance = SignedData.GetInstance(contentInfo.content);
|
|
this.signedData = instance;
|
|
}
|
|
|
|
// Token: 0x0600C161 RID: 49505 RVA: 0x002BA720 File Offset: 0x002B8920
|
|
[Token(Token = "0x600C161")]
|
|
[Address(RVA = "0x214CA60", Offset = "0x214BA60", VA = "0x18214CA60")]
|
|
public CmsSignedData(CmsProcessable signedContent, Stream sigData)
|
|
{
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(sigData);
|
|
}
|
|
|
|
// Token: 0x0600C162 RID: 49506 RVA: 0x002BA734 File Offset: 0x002B8934
|
|
[Token(Token = "0x600C162")]
|
|
[Address(RVA = "0x214CAA0", Offset = "0x214BAA0", VA = "0x18214CAA0")]
|
|
public CmsSignedData(Stream sigData)
|
|
{
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(sigData);
|
|
}
|
|
|
|
// Token: 0x0600C163 RID: 49507 RVA: 0x002BA748 File Offset: 0x002B8948
|
|
[Token(Token = "0x600C163")]
|
|
[Address(RVA = "0x214CAD0", Offset = "0x214BAD0", VA = "0x18214CAD0")]
|
|
public CmsSignedData(CmsProcessable signedContent, ContentInfo sigData)
|
|
{
|
|
this.signedContent = signedContent;
|
|
this.contentInfo = sigData;
|
|
SignedData instance = SignedData.GetInstance(sigData.content);
|
|
this.signedData = instance;
|
|
}
|
|
|
|
// Token: 0x0600C164 RID: 49508 RVA: 0x002BA784 File Offset: 0x002B8984
|
|
[Token(Token = "0x600C164")]
|
|
[Address(RVA = "0x214CB60", Offset = "0x214BB60", VA = "0x18214CB60")]
|
|
public CmsSignedData(IDictionary hashes, ContentInfo sigData)
|
|
{
|
|
this.hashes = hashes;
|
|
this.contentInfo = sigData;
|
|
SignedData instance = SignedData.GetInstance(sigData.content);
|
|
this.signedData = instance;
|
|
}
|
|
|
|
// Token: 0x0600C165 RID: 49509 RVA: 0x002BA7C0 File Offset: 0x002B89C0
|
|
[Token(Token = "0x600C165")]
|
|
[Address(RVA = "0x214CDF0", Offset = "0x214BDF0", VA = "0x18214CDF0")]
|
|
public CmsSignedData(ContentInfo sigData)
|
|
{
|
|
Asn1Encodable content;
|
|
do
|
|
{
|
|
base..ctor();
|
|
this.contentInfo = sigData;
|
|
SignedData instance = SignedData.GetInstance(sigData.content);
|
|
this.signedData = instance;
|
|
content = instance.contentInfo.content;
|
|
if (content == 0)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
while (content == 0 || content == 0);
|
|
CmsProcessableByteArray cmsProcessableByteArray;
|
|
this.signedContent = cmsProcessableByteArray;
|
|
}
|
|
|
|
// Token: 0x17001DFE RID: 7678
|
|
// (get) Token: 0x0600C166 RID: 49510 RVA: 0x002BA818 File Offset: 0x002B8A18
|
|
[Token(Token = "0x17001DFE")]
|
|
public int Version
|
|
{
|
|
[Token(Token = "0x600C166")]
|
|
[Address(RVA = "0x214CFC0", Offset = "0x214BFC0", VA = "0x18214CFC0")]
|
|
get
|
|
{
|
|
return this.signedData.version.Value.IntValue;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600C167 RID: 49511 RVA: 0x002BA840 File Offset: 0x002B8A40
|
|
[Token(Token = "0x600C167")]
|
|
[Address(RVA = "0x214BC90", Offset = "0x214AC90", VA = "0x18214BC90")]
|
|
public SignerInformationStore GetSignerInfos()
|
|
{
|
|
SignerInformationStore signerInformationStore;
|
|
IList list;
|
|
int num5;
|
|
do
|
|
{
|
|
int num = 0;
|
|
signerInformationStore = this.signerInfoStore;
|
|
if (signerInformationStore != 0)
|
|
{
|
|
return signerInformationStore;
|
|
}
|
|
list = Platform.CreateArrayList();
|
|
IEnumerator enumerator = this.signedData.signerInfos.GetEnumerator();
|
|
int num4;
|
|
if (enumerator != 0)
|
|
{
|
|
if (num < enumerator)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
DerObjectIdentifier contentType = this.signedData.contentInfo.contentType;
|
|
SignerInfo signerInfo;
|
|
if (this.hashes != 0)
|
|
{
|
|
Asn1Object asn1Object = signerInfo.digAlgorithm.ToAsn1Object();
|
|
BaseDigestCalculator baseDigestCalculator;
|
|
baseDigestCalculator.digest = asn1Object;
|
|
int num2;
|
|
SignerInformation signerInformation = new SignerInformation(signerInfo, contentType, num2, baseDigestCalculator);
|
|
int num3 = 0;
|
|
num2 = 0;
|
|
num3++;
|
|
num3 += 19;
|
|
}
|
|
CmsProcessable cmsProcessable = this.signedContent;
|
|
SignerInformation signerInformation2 = new SignerInformation(signerInfo, contentType, cmsProcessable, num4);
|
|
num4 = 0;
|
|
num5 = 0;
|
|
}
|
|
if (num4 != 0)
|
|
{
|
|
}
|
|
}
|
|
while (num5 != 0);
|
|
SignerInformationStore signerInformationStore2 = new SignerInformationStore(list);
|
|
this.signerInfoStore = signerInformationStore2;
|
|
return signerInformationStore;
|
|
}
|
|
|
|
// Token: 0x0600C168 RID: 49512 RVA: 0x002BA958 File Offset: 0x002B8B58
|
|
[Token(Token = "0x600C168")]
|
|
[Address(RVA = "0x214BA90", Offset = "0x214AA90", VA = "0x18214BA90")]
|
|
public IX509Store GetAttributeCertificates(string type)
|
|
{
|
|
IX509Store ix509Store = this.attrCertStore;
|
|
if (ix509Store == 0)
|
|
{
|
|
CmsSignedHelper helper = CmsSignedData.Helper;
|
|
Asn1Set certificates = this.signedData.certificates;
|
|
IX509Store ix509Store2 = helper.CreateAttributeStore(type, certificates);
|
|
this.attrCertStore = ix509Store2;
|
|
}
|
|
return ix509Store;
|
|
}
|
|
|
|
// Token: 0x0600C169 RID: 49513 RVA: 0x002BA99C File Offset: 0x002B8B9C
|
|
[Token(Token = "0x600C169")]
|
|
[Address(RVA = "0x214BB30", Offset = "0x214AB30", VA = "0x18214BB30")]
|
|
public IX509Store GetCertificates(string type)
|
|
{
|
|
IX509Store ix509Store = this.certificateStore;
|
|
if (ix509Store == 0)
|
|
{
|
|
CmsSignedHelper helper = CmsSignedData.Helper;
|
|
Asn1Set certificates = this.signedData.certificates;
|
|
IX509Store ix509Store2 = helper.CreateCertificateStore(type, certificates);
|
|
this.certificateStore = ix509Store2;
|
|
}
|
|
return ix509Store;
|
|
}
|
|
|
|
// Token: 0x0600C16A RID: 49514 RVA: 0x002BA9E0 File Offset: 0x002B8BE0
|
|
[Token(Token = "0x600C16A")]
|
|
[Address(RVA = "0x214BBD0", Offset = "0x214ABD0", VA = "0x18214BBD0")]
|
|
public IX509Store GetCrls(string type)
|
|
{
|
|
IX509Store ix509Store = this.crlStore;
|
|
if (ix509Store == 0)
|
|
{
|
|
CmsSignedHelper helper = CmsSignedData.Helper;
|
|
Asn1Set crls = this.signedData.crls;
|
|
IX509Store ix509Store2 = helper.CreateCrlStore(type, crls);
|
|
this.crlStore = ix509Store2;
|
|
}
|
|
return ix509Store;
|
|
}
|
|
|
|
// Token: 0x17001DFF RID: 7679
|
|
// (get) Token: 0x0600C16B RID: 49515 RVA: 0x002BAA24 File Offset: 0x002B8C24
|
|
[Token(Token = "0x17001DFF")]
|
|
[Obsolete]
|
|
public string SignedContentTypeOid
|
|
{
|
|
[Token(Token = "0x600C16B")]
|
|
[Address(RVA = "0x214CF60", Offset = "0x214BF60", VA = "0x18214CF60")]
|
|
get
|
|
{
|
|
return this.signedData.contentInfo.contentType.identifier;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001E00 RID: 7680
|
|
// (get) Token: 0x0600C16C RID: 49516 RVA: 0x002BAA4C File Offset: 0x002B8C4C
|
|
[Token(Token = "0x17001E00")]
|
|
public DerObjectIdentifier SignedContentType
|
|
{
|
|
[Token(Token = "0x600C16C")]
|
|
[Address(RVA = "0x214CF90", Offset = "0x214BF90", VA = "0x18214CF90")]
|
|
get
|
|
{
|
|
return this.signedData.contentInfo.contentType;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001E01 RID: 7681
|
|
// (get) Token: 0x0600C16D RID: 49517 RVA: 0x002BAA70 File Offset: 0x002B8C70
|
|
[Token(Token = "0x17001E01")]
|
|
public CmsProcessable SignedContent
|
|
{
|
|
[Token(Token = "0x600C16D")]
|
|
[Address(RVA = "0x411530", Offset = "0x410530", VA = "0x180411530")]
|
|
get
|
|
{
|
|
return this.signedContent;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001E02 RID: 7682
|
|
// (get) Token: 0x0600C16E RID: 49518 RVA: 0x002BAA84 File Offset: 0x002B8C84
|
|
[Token(Token = "0x17001E02")]
|
|
public ContentInfo ContentInfo
|
|
{
|
|
[Token(Token = "0x600C16E")]
|
|
[Address(RVA = "0x4157C0", Offset = "0x4147C0", VA = "0x1804157C0")]
|
|
get
|
|
{
|
|
return this.contentInfo;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600C16F RID: 49519 RVA: 0x002BAA98 File Offset: 0x002B8C98
|
|
[Token(Token = "0x600C16F")]
|
|
[Address(RVA = "0x214BC70", Offset = "0x214AC70", VA = "0x18214BC70")]
|
|
public byte[] GetEncoded()
|
|
{
|
|
return this.contentInfo.GetEncoded();
|
|
}
|
|
|
|
// Token: 0x0600C170 RID: 49520 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600C170")]
|
|
[Address(RVA = "0x214C2A0", Offset = "0x214B2A0", VA = "0x18214C2A0")]
|
|
public static CmsSignedData ReplaceSigners(CmsSignedData signedData, SignerInformationStore signerInformationStore)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600C171 RID: 49521 RVA: 0x002BAAB8 File Offset: 0x002B8CB8
|
|
[Token(Token = "0x600C171")]
|
|
[Address(RVA = "0x214C010", Offset = "0x214B010", VA = "0x18214C010")]
|
|
public static CmsSignedData ReplaceCertificatesAndCrls(CmsSignedData signedData, IX509Store x509Certs, IX509Store x509Crls, IX509Store x509AttrCerts)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600C171)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.CmsSignedData BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.CmsSignedData::ReplaceCertificatesAndCrls(BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.CmsSignedData,BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Store.IX509Store,BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Store.IX509Store,BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Store.IX509Store)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_B5:
|
|
stloc:Exception(var_16_BF, call:Exception(Platform::CreateNotImplementedException, ldstr:string("Currently can't replace attribute certificates")))
|
|
}
|
|
|
|
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: 0x04007A6C RID: 31340
|
|
[Token(Token = "0x4007A6C")]
|
|
private static readonly CmsSignedHelper Helper = CmsSignedHelper.Instance;
|
|
|
|
// Token: 0x04007A6D RID: 31341
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007A6D")]
|
|
private readonly CmsProcessable signedContent;
|
|
|
|
// Token: 0x04007A6E RID: 31342
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007A6E")]
|
|
private SignedData signedData;
|
|
|
|
// Token: 0x04007A6F RID: 31343
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007A6F")]
|
|
private ContentInfo contentInfo;
|
|
|
|
// Token: 0x04007A70 RID: 31344
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007A70")]
|
|
private SignerInformationStore signerInfoStore;
|
|
|
|
// Token: 0x04007A71 RID: 31345
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007A71")]
|
|
private IX509Store attrCertStore;
|
|
|
|
// Token: 0x04007A72 RID: 31346
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007A72")]
|
|
private IX509Store certificateStore;
|
|
|
|
// Token: 0x04007A73 RID: 31347
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4007A73")]
|
|
private IX509Store crlStore;
|
|
|
|
// Token: 0x04007A74 RID: 31348
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x4007A74")]
|
|
private IDictionary hashes;
|
|
}
|
|
}
|