380 lines
14 KiB
C#
380 lines
14 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.CryptoPro;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Nist;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Oiw;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.TeleTrust;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X9;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
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: 0x02001E2D RID: 7725
|
|
[Token(Token = "0x2001E2D")]
|
|
public class CmsSignedGenerator
|
|
{
|
|
// Token: 0x0600C1CD RID: 49613 RVA: 0x002BCA9C File Offset: 0x002BAC9C
|
|
[Token(Token = "0x600C1CD")]
|
|
[Address(RVA = "0x2924FA0", Offset = "0x2923FA0", VA = "0x182924FA0")]
|
|
protected CmsSignedGenerator()
|
|
{
|
|
SecureRandom secureRandom = new SecureRandom();
|
|
}
|
|
|
|
// Token: 0x0600C1CE RID: 49614 RVA: 0x002BCAB0 File Offset: 0x002BACB0
|
|
[Token(Token = "0x600C1CE")]
|
|
[Address(RVA = "0x2924F10", Offset = "0x2923F10", VA = "0x182924F10")]
|
|
protected CmsSignedGenerator(SecureRandom rand)
|
|
{
|
|
IList list = Platform.CreateArrayList();
|
|
this._certs = list;
|
|
IList list2 = Platform.CreateArrayList();
|
|
this._crls = list2;
|
|
IList list3 = Platform.CreateArrayList();
|
|
this._signers = list3;
|
|
IDictionary dictionary = Platform.CreateHashtable();
|
|
int num = 0;
|
|
this._digests = dictionary;
|
|
this.AddSignerCallback(num);
|
|
this.rand = rand;
|
|
}
|
|
|
|
// Token: 0x0600C1CF RID: 49615 RVA: 0x002BCB14 File Offset: 0x002BAD14
|
|
[Token(Token = "0x600C1CF")]
|
|
[Address(RVA = "0x29247B0", Offset = "0x29237B0", VA = "0x1829247B0", Slot = "4")]
|
|
protected internal virtual IDictionary GetBaseParameters(DerObjectIdentifier contentType, AlgorithmIdentifier digAlgId, byte[] hash)
|
|
{
|
|
IDictionary dictionary = Platform.CreateHashtable();
|
|
if (contentType != 0)
|
|
{
|
|
}
|
|
return dictionary;
|
|
}
|
|
|
|
// Token: 0x0600C1D0 RID: 49616 RVA: 0x002BCB34 File Offset: 0x002BAD34
|
|
[Token(Token = "0x600C1D0")]
|
|
[Address(RVA = "0x2924740", Offset = "0x2923740", VA = "0x182924740", Slot = "5")]
|
|
protected internal virtual Asn1Set GetAttributeSet(BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable attr)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600C1D0)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Asn1Set BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.CmsSignedGenerator::GetAttributeSet(BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_06:
|
|
stloc:DerSet(var_1_11, newobj:DerSet(DerSet::.ctor, call:Asn1EncodableVector(AttributeTable::ToAsn1EncodableVector, ldloc:AttributeTable(attr))))
|
|
}
|
|
|
|
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: 0x0600C1D1 RID: 49617 RVA: 0x002BCB54 File Offset: 0x002BAD54
|
|
[Token(Token = "0x600C1D1")]
|
|
[Address(RVA = "0x2924410", Offset = "0x2923410", VA = "0x182924410")]
|
|
public void AddCertificates(IX509Store certStore)
|
|
{
|
|
IList certs = this._certs;
|
|
IList certificatesFromStore = CmsUtilities.GetCertificatesFromStore(certStore);
|
|
CollectionUtilities.AddRange(certs, certificatesFromStore);
|
|
}
|
|
|
|
// Token: 0x0600C1D2 RID: 49618 RVA: 0x002BCB78 File Offset: 0x002BAD78
|
|
[Token(Token = "0x600C1D2")]
|
|
[Address(RVA = "0x2924440", Offset = "0x2923440", VA = "0x182924440")]
|
|
public void AddCrls(IX509Store crlStore)
|
|
{
|
|
IList crls = this._crls;
|
|
IList crlsFromStore = CmsUtilities.GetCrlsFromStore(crlStore);
|
|
CollectionUtilities.AddRange(crls, crlsFromStore);
|
|
}
|
|
|
|
// Token: 0x0600C1D3 RID: 49619 RVA: 0x002BCB9C File Offset: 0x002BAD9C
|
|
[Token(Token = "0x600C1D3")]
|
|
[Address(RVA = "0x29240C0", Offset = "0x29230C0", VA = "0x1829240C0")]
|
|
public void AddAttributeCertificates(IX509Store store)
|
|
{
|
|
int num = 0;
|
|
num += num;
|
|
num++;
|
|
IList certs = this._certs;
|
|
uint num2;
|
|
if (num < (int)num2)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
Asn1Object asn1Object;
|
|
AttributeCertificate instance = AttributeCertificate.GetInstance(asn1Object);
|
|
int num3;
|
|
DerTaggedObject derTaggedObject = new DerTaggedObject(num3 != 0, 2, instance);
|
|
num3 = 0;
|
|
if (num < 2)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
derTaggedObject += derTaggedObject;
|
|
num += 15;
|
|
num += 19;
|
|
num += typeof(IList).TypeHandle;
|
|
derTaggedObject += derTaggedObject;
|
|
num += 2;
|
|
num += 19;
|
|
if (num != 0)
|
|
{
|
|
}
|
|
if (num == 0)
|
|
{
|
|
return;
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600C1D4 RID: 49620 RVA: 0x002BCC48 File Offset: 0x002BAE48
|
|
[Token(Token = "0x600C1D4")]
|
|
[Address(RVA = "0x2924470", Offset = "0x2923470", VA = "0x182924470")]
|
|
public void AddSigners(SignerInformationStore signerStore)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
IList list = Platform.CreateArrayList(signerStore.all);
|
|
Asn1Set attributeSet;
|
|
if (list != 0)
|
|
{
|
|
if (num < list)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
if (num == 0)
|
|
{
|
|
num++;
|
|
num += 19;
|
|
}
|
|
if (num == 0)
|
|
{
|
|
goto IL_61;
|
|
}
|
|
IList signers = this._signers;
|
|
if (num < num)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
attributeSet = this.GetAttributeSet(num);
|
|
num += num;
|
|
}
|
|
if (attributeSet != 0)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
return;
|
|
IL_61:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600C1D5 RID: 49621 RVA: 0x002BCCBC File Offset: 0x002BAEBC
|
|
[Token(Token = "0x600C1D5")]
|
|
[Address(RVA = "0x2924900", Offset = "0x2923900", VA = "0x182924900")]
|
|
public IDictionary GetGeneratedDigests()
|
|
{
|
|
return Platform.CreateHashtable(this._digests);
|
|
}
|
|
|
|
// Token: 0x17001E0A RID: 7690
|
|
// (get) Token: 0x0600C1D6 RID: 49622 RVA: 0x002BCCD4 File Offset: 0x002BAED4
|
|
// (set) Token: 0x0600C1D7 RID: 49623 RVA: 0x002BCCE8 File Offset: 0x002BAEE8
|
|
[Token(Token = "0x17001E0A")]
|
|
public bool UseDerForCerts
|
|
{
|
|
[Token(Token = "0x600C1D6")]
|
|
[Address(RVA = "0x5AB2E0", Offset = "0x5AA2E0", VA = "0x1805AB2E0")]
|
|
get
|
|
{
|
|
return this._useDerForCerts;
|
|
}
|
|
[Token(Token = "0x600C1D7")]
|
|
[Address(RVA = "0x5AB400", Offset = "0x5AA400", VA = "0x1805AB400")]
|
|
set
|
|
{
|
|
this._useDerForCerts = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001E0B RID: 7691
|
|
// (get) Token: 0x0600C1D8 RID: 49624 RVA: 0x002BCCFC File Offset: 0x002BAEFC
|
|
// (set) Token: 0x0600C1D9 RID: 49625 RVA: 0x002BCD10 File Offset: 0x002BAF10
|
|
[Token(Token = "0x17001E0B")]
|
|
public bool UseDerForCrls
|
|
{
|
|
[Token(Token = "0x600C1D8")]
|
|
[Address(RVA = "0x8920D0", Offset = "0x8910D0", VA = "0x1808920D0")]
|
|
get
|
|
{
|
|
return this._useDerForCrls;
|
|
}
|
|
[Token(Token = "0x600C1D9")]
|
|
[Address(RVA = "0xCA2F10", Offset = "0xCA1F10", VA = "0x180CA2F10")]
|
|
set
|
|
{
|
|
this._useDerForCrls = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600C1DA RID: 49626 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600C1DA")]
|
|
[Address(RVA = "0x4242D0", Offset = "0x4232D0", VA = "0x1804242D0", Slot = "6")]
|
|
internal virtual void AddSignerCallback(SignerInformation si)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600C1DB RID: 49627 RVA: 0x002BCD24 File Offset: 0x002BAF24
|
|
[Token(Token = "0x600C1DB")]
|
|
[Address(RVA = "0x2924960", Offset = "0x2923960", VA = "0x182924960")]
|
|
internal static SignerIdentifier GetSignerIdentifier(X509Certificate cert)
|
|
{
|
|
DateTime notAfter = cert.NotAfter;
|
|
Asn1Object asn1Object;
|
|
TbsCertificateStructure instance = TbsCertificateStructure.GetInstance(asn1Object);
|
|
DerInteger serialNumber = instance.serialNumber;
|
|
X509Name issuer = instance.issuer;
|
|
BigInteger value = serialNumber.Value;
|
|
return new SignerIdentifier(new BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.IssuerAndSerialNumber(issuer, value));
|
|
}
|
|
|
|
// Token: 0x0600C1DC RID: 49628 RVA: 0x002BCD6C File Offset: 0x002BAF6C
|
|
[Token(Token = "0x600C1DC")]
|
|
[Address(RVA = "0x2924A50", Offset = "0x2923A50", VA = "0x182924A50")]
|
|
internal static SignerIdentifier GetSignerIdentifier(byte[] subjectKeyIdentifier)
|
|
{
|
|
return new SignerIdentifier(new DerOctetString(subjectKeyIdentifier));
|
|
}
|
|
|
|
// Token: 0x04007AA5 RID: 31397
|
|
[Token(Token = "0x4007AA5")]
|
|
public static readonly string Data = CmsObjectIdentifiers.Data.identifier;
|
|
|
|
// Token: 0x04007AA6 RID: 31398
|
|
[Token(Token = "0x4007AA6")]
|
|
public static readonly string DigestSha1 = OiwObjectIdentifiers.IdSha1.identifier;
|
|
|
|
// Token: 0x04007AA7 RID: 31399
|
|
[Token(Token = "0x4007AA7")]
|
|
public static readonly string DigestSha224 = NistObjectIdentifiers.IdSha224.identifier;
|
|
|
|
// Token: 0x04007AA8 RID: 31400
|
|
[Token(Token = "0x4007AA8")]
|
|
public static readonly string DigestSha256 = NistObjectIdentifiers.IdSha256.identifier;
|
|
|
|
// Token: 0x04007AA9 RID: 31401
|
|
[Token(Token = "0x4007AA9")]
|
|
public static readonly string DigestSha384 = NistObjectIdentifiers.IdSha384.identifier;
|
|
|
|
// Token: 0x04007AAA RID: 31402
|
|
[Token(Token = "0x4007AAA")]
|
|
public static readonly string DigestSha512 = NistObjectIdentifiers.IdSha512.identifier;
|
|
|
|
// Token: 0x04007AAB RID: 31403
|
|
[Token(Token = "0x4007AAB")]
|
|
public static readonly string DigestMD5 = PkcsObjectIdentifiers.MD5.identifier;
|
|
|
|
// Token: 0x04007AAC RID: 31404
|
|
[Token(Token = "0x4007AAC")]
|
|
public static readonly string DigestGost3411 = CryptoProObjectIdentifiers.GostR3411.identifier;
|
|
|
|
// Token: 0x04007AAD RID: 31405
|
|
[Token(Token = "0x4007AAD")]
|
|
public static readonly string DigestRipeMD128 = TeleTrusTObjectIdentifiers.RipeMD128.identifier;
|
|
|
|
// Token: 0x04007AAE RID: 31406
|
|
[Token(Token = "0x4007AAE")]
|
|
public static readonly string DigestRipeMD160 = TeleTrusTObjectIdentifiers.RipeMD160.identifier;
|
|
|
|
// Token: 0x04007AAF RID: 31407
|
|
[Token(Token = "0x4007AAF")]
|
|
public static readonly string DigestRipeMD256 = TeleTrusTObjectIdentifiers.RipeMD256.identifier;
|
|
|
|
// Token: 0x04007AB0 RID: 31408
|
|
[Token(Token = "0x4007AB0")]
|
|
public static readonly string EncryptionRsa = PkcsObjectIdentifiers.RsaEncryption.identifier;
|
|
|
|
// Token: 0x04007AB1 RID: 31409
|
|
[Token(Token = "0x4007AB1")]
|
|
public static readonly string EncryptionDsa = X9ObjectIdentifiers.IdDsaWithSha1.identifier;
|
|
|
|
// Token: 0x04007AB2 RID: 31410
|
|
[Token(Token = "0x4007AB2")]
|
|
public static readonly string EncryptionECDsa = X9ObjectIdentifiers.ECDsaWithSha1.identifier;
|
|
|
|
// Token: 0x04007AB3 RID: 31411
|
|
[Token(Token = "0x4007AB3")]
|
|
public static readonly string EncryptionRsaPss = PkcsObjectIdentifiers.IdRsassaPss.identifier;
|
|
|
|
// Token: 0x04007AB4 RID: 31412
|
|
[Token(Token = "0x4007AB4")]
|
|
public static readonly string EncryptionGost3410 = CryptoProObjectIdentifiers.GostR3410x94.identifier;
|
|
|
|
// Token: 0x04007AB5 RID: 31413
|
|
[Token(Token = "0x4007AB5")]
|
|
public static readonly string EncryptionECGost3410 = CryptoProObjectIdentifiers.GostR3410x2001.identifier;
|
|
|
|
// Token: 0x04007AB6 RID: 31414
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007AB6")]
|
|
internal IList _certs;
|
|
|
|
// Token: 0x04007AB7 RID: 31415
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007AB7")]
|
|
internal IList _crls;
|
|
|
|
// Token: 0x04007AB8 RID: 31416
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007AB8")]
|
|
internal IList _signers;
|
|
|
|
// Token: 0x04007AB9 RID: 31417
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007AB9")]
|
|
internal IDictionary _digests;
|
|
|
|
// Token: 0x04007ABA RID: 31418
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007ABA")]
|
|
internal bool _useDerForCerts;
|
|
|
|
// Token: 0x04007ABB RID: 31419
|
|
[FieldOffset(Offset = "0x31")]
|
|
[Token(Token = "0x4007ABB")]
|
|
internal bool _useDerForCrls;
|
|
|
|
// Token: 0x04007ABC RID: 31420
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007ABC")]
|
|
protected readonly SecureRandom rand;
|
|
}
|
|
}
|