391 lines
15 KiB
C#
391 lines
15 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
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: 0x02001767 RID: 5991
|
|
[Token(Token = "0x2001767")]
|
|
[StructLayout(3)]
|
|
public class CmsSignedData
|
|
{
|
|
// Token: 0x0600A1B5 RID: 41397 RVA: 0x00259994 File Offset: 0x00257B94
|
|
[Token(Token = "0x600A1B5")]
|
|
[Address(RVA = "0x1C812B0", Offset = "0x1C7FCB0", VA = "0x181C812B0")]
|
|
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: 0x0600A1B6 RID: 41398 RVA: 0x002599E8 File Offset: 0x00257BE8
|
|
[Token(Token = "0x600A1B6")]
|
|
[Address(RVA = "0x1C81300", Offset = "0x1C7FD00", VA = "0x181C81300")]
|
|
public CmsSignedData(byte[] sigBlock)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(sigBlock, num != 0);
|
|
num = 0;
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(new Asn1InputStream(memoryStream, int.MaxValue));
|
|
}
|
|
|
|
// Token: 0x0600A1B7 RID: 41399 RVA: 0x00259A10 File Offset: 0x00257C10
|
|
[Token(Token = "0x600A1B7")]
|
|
[Address(RVA = "0x1C81100", Offset = "0x1C7FB00", VA = "0x181C81100")]
|
|
public CmsSignedData(CmsProcessable signedContent, byte[] sigBlock)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(sigBlock, num != 0);
|
|
num = 0;
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(new Asn1InputStream(memoryStream, int.MaxValue));
|
|
}
|
|
|
|
// Token: 0x0600A1B8 RID: 41400 RVA: 0x00259A38 File Offset: 0x00257C38
|
|
[Token(Token = "0x600A1B8")]
|
|
[Address(RVA = "0x1C811D0", Offset = "0x1C7FBD0", VA = "0x181C811D0")]
|
|
public CmsSignedData(IDictionary hashes, byte[] sigBlock)
|
|
{
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(new Asn1InputStream(sigBlock));
|
|
base..ctor();
|
|
this.hashes = hashes;
|
|
this.contentInfo = contentInfo;
|
|
SignedData instance = SignedData.GetInstance(contentInfo.content);
|
|
this.signedData = instance;
|
|
}
|
|
|
|
// Token: 0x0600A1B9 RID: 41401 RVA: 0x00259A80 File Offset: 0x00257C80
|
|
[Token(Token = "0x600A1B9")]
|
|
[Address(RVA = "0x1C80ED0", Offset = "0x1C7F8D0", VA = "0x181C80ED0")]
|
|
public CmsSignedData(CmsProcessable signedContent, Stream sigData)
|
|
{
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(new Asn1InputStream(sigData, int.MaxValue));
|
|
}
|
|
|
|
// Token: 0x0600A1BA RID: 41402 RVA: 0x00259AA0 File Offset: 0x00257CA0
|
|
[Token(Token = "0x600A1BA")]
|
|
[Address(RVA = "0x1C80F60", Offset = "0x1C7F960", VA = "0x181C80F60")]
|
|
public CmsSignedData(Stream sigData)
|
|
{
|
|
ContentInfo contentInfo = CmsUtilities.ReadContentInfo(new Asn1InputStream(sigData, int.MaxValue));
|
|
}
|
|
|
|
// Token: 0x0600A1BB RID: 41403 RVA: 0x00259AC0 File Offset: 0x00257CC0
|
|
[Token(Token = "0x600A1BB")]
|
|
[Address(RVA = "0x1C80FE0", Offset = "0x1C7F9E0", VA = "0x181C80FE0")]
|
|
public CmsSignedData(CmsProcessable signedContent, ContentInfo sigData)
|
|
{
|
|
this.signedContent = signedContent;
|
|
this.contentInfo = sigData;
|
|
SignedData instance = SignedData.GetInstance(sigData.content);
|
|
this.signedData = instance;
|
|
}
|
|
|
|
// Token: 0x0600A1BC RID: 41404 RVA: 0x00259AFC File Offset: 0x00257CFC
|
|
[Token(Token = "0x600A1BC")]
|
|
[Address(RVA = "0x1C81070", Offset = "0x1C7FA70", VA = "0x181C81070")]
|
|
public CmsSignedData(IDictionary hashes, ContentInfo sigData)
|
|
{
|
|
this.hashes = hashes;
|
|
this.contentInfo = sigData;
|
|
SignedData instance = SignedData.GetInstance(sigData.content);
|
|
this.signedData = instance;
|
|
}
|
|
|
|
// Token: 0x0600A1BD RID: 41405 RVA: 0x00259B38 File Offset: 0x00257D38
|
|
[Token(Token = "0x600A1BD")]
|
|
[Address(RVA = "0x1C813C0", Offset = "0x1C7FDC0", VA = "0x181C813C0")]
|
|
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: 0x17001960 RID: 6496
|
|
// (get) Token: 0x0600A1BE RID: 41406 RVA: 0x00259B90 File Offset: 0x00257D90
|
|
[Token(Token = "0x17001960")]
|
|
public int Version
|
|
{
|
|
[Token(Token = "0x600A1BE")]
|
|
[Address(RVA = "0x668C80", Offset = "0x667680", VA = "0x180668C80")]
|
|
get
|
|
{
|
|
return this.signedData.version.Value.IntValue;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600A1BF RID: 41407 RVA: 0x00259BB8 File Offset: 0x00257DB8
|
|
[Token(Token = "0x600A1BF")]
|
|
[Address(RVA = "0x1C800A0", Offset = "0x1C7EAA0", VA = "0x181C800A0")]
|
|
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)
|
|
{
|
|
}
|
|
if (num5 != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num5 != 0);
|
|
SignerInformationStore signerInformationStore2 = new SignerInformationStore(list);
|
|
this.signerInfoStore = signerInformationStore2;
|
|
return signerInformationStore;
|
|
}
|
|
|
|
// Token: 0x0600A1C0 RID: 41408 RVA: 0x00259CD4 File Offset: 0x00257ED4
|
|
[Token(Token = "0x600A1C0")]
|
|
[Address(RVA = "0x1C7FEA0", Offset = "0x1C7E8A0", VA = "0x181C7FEA0")]
|
|
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: 0x0600A1C1 RID: 41409 RVA: 0x00259D18 File Offset: 0x00257F18
|
|
[Token(Token = "0x600A1C1")]
|
|
[Address(RVA = "0x1C7FF40", Offset = "0x1C7E940", VA = "0x181C7FF40")]
|
|
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: 0x0600A1C2 RID: 41410 RVA: 0x00259D5C File Offset: 0x00257F5C
|
|
[Token(Token = "0x600A1C2")]
|
|
[Address(RVA = "0x1C7FFE0", Offset = "0x1C7E9E0", VA = "0x181C7FFE0")]
|
|
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: 0x17001961 RID: 6497
|
|
// (get) Token: 0x0600A1C3 RID: 41411 RVA: 0x00259DA0 File Offset: 0x00257FA0
|
|
[Token(Token = "0x17001961")]
|
|
[Obsolete]
|
|
public string SignedContentTypeOid
|
|
{
|
|
[Token(Token = "0x600A1C3")]
|
|
[Address(RVA = "0x1C81530", Offset = "0x1C7FF30", VA = "0x181C81530")]
|
|
get
|
|
{
|
|
return this.signedData.contentInfo.contentType.identifier;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001962 RID: 6498
|
|
// (get) Token: 0x0600A1C4 RID: 41412 RVA: 0x00259DC8 File Offset: 0x00257FC8
|
|
[Token(Token = "0x17001962")]
|
|
public DerObjectIdentifier SignedContentType
|
|
{
|
|
[Token(Token = "0x600A1C4")]
|
|
[Address(RVA = "0x1C81560", Offset = "0x1C7FF60", VA = "0x181C81560")]
|
|
get
|
|
{
|
|
return this.signedData.contentInfo.contentType;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001963 RID: 6499
|
|
// (get) Token: 0x0600A1C5 RID: 41413 RVA: 0x00259DEC File Offset: 0x00257FEC
|
|
[Token(Token = "0x17001963")]
|
|
public CmsProcessable SignedContent
|
|
{
|
|
[Token(Token = "0x600A1C5")]
|
|
[Address(RVA = "0x3C39A0", Offset = "0x3C23A0", VA = "0x1803C39A0")]
|
|
get
|
|
{
|
|
return this.signedContent;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001964 RID: 6500
|
|
// (get) Token: 0x0600A1C6 RID: 41414 RVA: 0x00259E00 File Offset: 0x00258000
|
|
[Token(Token = "0x17001964")]
|
|
public ContentInfo ContentInfo
|
|
{
|
|
[Token(Token = "0x600A1C6")]
|
|
[Address(RVA = "0x3C1220", Offset = "0x3BFC20", VA = "0x1803C1220")]
|
|
get
|
|
{
|
|
return this.contentInfo;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600A1C7 RID: 41415 RVA: 0x00259E14 File Offset: 0x00258014
|
|
[Token(Token = "0x600A1C7")]
|
|
[Address(RVA = "0x1C80080", Offset = "0x1C7EA80", VA = "0x181C80080")]
|
|
public byte[] GetEncoded()
|
|
{
|
|
return this.contentInfo.GetEncoded();
|
|
}
|
|
|
|
// Token: 0x0600A1C8 RID: 41416 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600A1C8")]
|
|
[Address(RVA = "0x1C806F0", Offset = "0x1C7F0F0", VA = "0x181C806F0")]
|
|
public static CmsSignedData ReplaceSigners(CmsSignedData signedData, SignerInformationStore signerInformationStore)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600A1C9 RID: 41417 RVA: 0x00259E34 File Offset: 0x00258034
|
|
[Token(Token = "0x600A1C9")]
|
|
[Address(RVA = "0x1C80460", Offset = "0x1C7EE60", VA = "0x181C80460")]
|
|
public static CmsSignedData ReplaceCertificatesAndCrls(CmsSignedData signedData, IX509Store x509Certs, IX509Store x509Crls, IX509Store x509AttrCerts)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600A1C9)
|
|
|
|
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: 0x04006A70 RID: 27248
|
|
[Token(Token = "0x4006A70")]
|
|
private static readonly CmsSignedHelper Helper = CmsSignedHelper.Instance;
|
|
|
|
// Token: 0x04006A71 RID: 27249
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006A71")]
|
|
private readonly CmsProcessable signedContent;
|
|
|
|
// Token: 0x04006A72 RID: 27250
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006A72")]
|
|
private SignedData signedData;
|
|
|
|
// Token: 0x04006A73 RID: 27251
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006A73")]
|
|
private ContentInfo contentInfo;
|
|
|
|
// Token: 0x04006A74 RID: 27252
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4006A74")]
|
|
private SignerInformationStore signerInfoStore;
|
|
|
|
// Token: 0x04006A75 RID: 27253
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4006A75")]
|
|
private IX509Store attrCertStore;
|
|
|
|
// Token: 0x04006A76 RID: 27254
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4006A76")]
|
|
private IX509Store certificateStore;
|
|
|
|
// Token: 0x04006A77 RID: 27255
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4006A77")]
|
|
private IX509Store crlStore;
|
|
|
|
// Token: 0x04006A78 RID: 27256
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x4006A78")]
|
|
private IDictionary hashes;
|
|
}
|
|
}
|