Files
2026-04-10 22:50:51 +02:00

391 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: 0x02001D4D RID: 7501
[Token(Token = "0x2001D4D")]
public class CmsSignedGenerator
{
// Token: 0x0600BDFF RID: 48639 RVA: 0x002B414C File Offset: 0x002B234C
[Token(Token = "0x600BDFF")]
[Address(RVA = "0x20017C0", Offset = "0x20005C0", VA = "0x1820017C0")]
protected CmsSignedGenerator()
{
SecureRandom secureRandom = new SecureRandom();
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 = secureRandom;
}
// Token: 0x0600BE00 RID: 48640 RVA: 0x002B41B8 File Offset: 0x002B23B8
[Token(Token = "0x600BE00")]
[Address(RVA = "0x2001730", Offset = "0x2000530", VA = "0x182001730")]
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: 0x0600BE01 RID: 48641 RVA: 0x002B421C File Offset: 0x002B241C
[Token(Token = "0x600BE01")]
[Address(RVA = "0x2000FD0", Offset = "0x1FFFDD0", VA = "0x182000FD0", Slot = "4")]
protected internal virtual IDictionary GetBaseParameters(DerObjectIdentifier contentType, AlgorithmIdentifier digAlgId, byte[] hash)
{
IDictionary dictionary = Platform.CreateHashtable();
if (contentType != 0)
{
}
return dictionary;
}
// Token: 0x0600BE02 RID: 48642 RVA: 0x002B423C File Offset: 0x002B243C
[Token(Token = "0x600BE02")]
[Address(RVA = "0x2000F60", Offset = "0x1FFFD60", VA = "0x182000F60", Slot = "5")]
protected internal virtual Asn1Set GetAttributeSet(BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable attr)
{
/*
An exception occurred when decompiling this method (0600BE02)
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: 0x0600BE03 RID: 48643 RVA: 0x002B425C File Offset: 0x002B245C
[Token(Token = "0x600BE03")]
[Address(RVA = "0x2000C30", Offset = "0x1FFFA30", VA = "0x182000C30")]
public void AddCertificates(IX509Store certStore)
{
IList certs = this._certs;
IList certificatesFromStore = CmsUtilities.GetCertificatesFromStore(certStore);
CollectionUtilities.AddRange(certs, certificatesFromStore);
}
// Token: 0x0600BE04 RID: 48644 RVA: 0x002B4280 File Offset: 0x002B2480
[Token(Token = "0x600BE04")]
[Address(RVA = "0x2000C60", Offset = "0x1FFFA60", VA = "0x182000C60")]
public void AddCrls(IX509Store crlStore)
{
IList crls = this._crls;
IList crlsFromStore = CmsUtilities.GetCrlsFromStore(crlStore);
CollectionUtilities.AddRange(crls, crlsFromStore);
}
// Token: 0x0600BE05 RID: 48645 RVA: 0x002B42A4 File Offset: 0x002B24A4
[Token(Token = "0x600BE05")]
[Address(RVA = "0x20008E0", Offset = "0x1FFF6E0", VA = "0x1820008E0")]
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: 0x0600BE06 RID: 48646 RVA: 0x002B4350 File Offset: 0x002B2550
[Token(Token = "0x600BE06")]
[Address(RVA = "0x2000C90", Offset = "0x1FFFA90", VA = "0x182000C90")]
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: 0x0600BE07 RID: 48647 RVA: 0x002B43C4 File Offset: 0x002B25C4
[Token(Token = "0x600BE07")]
[Address(RVA = "0x2001120", Offset = "0x1FFFF20", VA = "0x182001120")]
public IDictionary GetGeneratedDigests()
{
return Platform.CreateHashtable(this._digests);
}
// Token: 0x17001D6D RID: 7533
// (get) Token: 0x0600BE08 RID: 48648 RVA: 0x002B43DC File Offset: 0x002B25DC
// (set) Token: 0x0600BE09 RID: 48649 RVA: 0x002B43F0 File Offset: 0x002B25F0
[Token(Token = "0x17001D6D")]
public bool UseDerForCerts
{
[Token(Token = "0x600BE08")]
[Address(RVA = "0x4364F0", Offset = "0x4352F0", VA = "0x1804364F0")]
get
{
return this._useDerForCerts;
}
[Token(Token = "0x600BE09")]
[Address(RVA = "0x436790", Offset = "0x435590", VA = "0x180436790")]
set
{
this._useDerForCerts = value;
}
}
// Token: 0x17001D6E RID: 7534
// (get) Token: 0x0600BE0A RID: 48650 RVA: 0x002B4404 File Offset: 0x002B2604
// (set) Token: 0x0600BE0B RID: 48651 RVA: 0x002B4418 File Offset: 0x002B2618
[Token(Token = "0x17001D6E")]
public bool UseDerForCrls
{
[Token(Token = "0x600BE0A")]
[Address(RVA = "0x4364D0", Offset = "0x4352D0", VA = "0x1804364D0")]
get
{
return this._useDerForCrls;
}
[Token(Token = "0x600BE0B")]
[Address(RVA = "0x436770", Offset = "0x435570", VA = "0x180436770")]
set
{
this._useDerForCrls = value;
}
}
// Token: 0x0600BE0C RID: 48652 RVA: 0x0000220F File Offset: 0x0000040F
[Token(Token = "0x600BE0C")]
[Address(RVA = "0x402080", Offset = "0x400E80", VA = "0x180402080", Slot = "6")]
internal virtual void AddSignerCallback(SignerInformation si)
{
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
}
// Token: 0x0600BE0D RID: 48653 RVA: 0x002B442C File Offset: 0x002B262C
[Token(Token = "0x600BE0D")]
[Address(RVA = "0x2001180", Offset = "0x1FFFF80", VA = "0x182001180")]
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: 0x0600BE0E RID: 48654 RVA: 0x002B4474 File Offset: 0x002B2674
[Token(Token = "0x600BE0E")]
[Address(RVA = "0x2001270", Offset = "0x2000070", VA = "0x182001270")]
internal static SignerIdentifier GetSignerIdentifier(byte[] subjectKeyIdentifier)
{
return new SignerIdentifier(new DerOctetString(subjectKeyIdentifier));
}
// Token: 0x040078EC RID: 30956
[Token(Token = "0x40078EC")]
public static readonly string Data = CmsObjectIdentifiers.Data.identifier;
// Token: 0x040078ED RID: 30957
[Token(Token = "0x40078ED")]
public static readonly string DigestSha1 = OiwObjectIdentifiers.IdSha1.identifier;
// Token: 0x040078EE RID: 30958
[Token(Token = "0x40078EE")]
public static readonly string DigestSha224 = NistObjectIdentifiers.IdSha224.identifier;
// Token: 0x040078EF RID: 30959
[Token(Token = "0x40078EF")]
public static readonly string DigestSha256 = NistObjectIdentifiers.IdSha256.identifier;
// Token: 0x040078F0 RID: 30960
[Token(Token = "0x40078F0")]
public static readonly string DigestSha384 = NistObjectIdentifiers.IdSha384.identifier;
// Token: 0x040078F1 RID: 30961
[Token(Token = "0x40078F1")]
public static readonly string DigestSha512 = NistObjectIdentifiers.IdSha512.identifier;
// Token: 0x040078F2 RID: 30962
[Token(Token = "0x40078F2")]
public static readonly string DigestMD5 = PkcsObjectIdentifiers.MD5.identifier;
// Token: 0x040078F3 RID: 30963
[Token(Token = "0x40078F3")]
public static readonly string DigestGost3411 = CryptoProObjectIdentifiers.GostR3411.identifier;
// Token: 0x040078F4 RID: 30964
[Token(Token = "0x40078F4")]
public static readonly string DigestRipeMD128 = TeleTrusTObjectIdentifiers.RipeMD128.identifier;
// Token: 0x040078F5 RID: 30965
[Token(Token = "0x40078F5")]
public static readonly string DigestRipeMD160 = TeleTrusTObjectIdentifiers.RipeMD160.identifier;
// Token: 0x040078F6 RID: 30966
[Token(Token = "0x40078F6")]
public static readonly string DigestRipeMD256 = TeleTrusTObjectIdentifiers.RipeMD256.identifier;
// Token: 0x040078F7 RID: 30967
[Token(Token = "0x40078F7")]
public static readonly string EncryptionRsa = PkcsObjectIdentifiers.RsaEncryption.identifier;
// Token: 0x040078F8 RID: 30968
[Token(Token = "0x40078F8")]
public static readonly string EncryptionDsa = X9ObjectIdentifiers.IdDsaWithSha1.identifier;
// Token: 0x040078F9 RID: 30969
[Token(Token = "0x40078F9")]
public static readonly string EncryptionECDsa = X9ObjectIdentifiers.ECDsaWithSha1.identifier;
// Token: 0x040078FA RID: 30970
[Token(Token = "0x40078FA")]
public static readonly string EncryptionRsaPss = PkcsObjectIdentifiers.IdRsassaPss.identifier;
// Token: 0x040078FB RID: 30971
[Token(Token = "0x40078FB")]
public static readonly string EncryptionGost3410 = CryptoProObjectIdentifiers.GostR3410x94.identifier;
// Token: 0x040078FC RID: 30972
[Token(Token = "0x40078FC")]
public static readonly string EncryptionECGost3410 = CryptoProObjectIdentifiers.GostR3410x2001.identifier;
// Token: 0x040078FD RID: 30973
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40078FD")]
internal IList _certs;
// Token: 0x040078FE RID: 30974
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40078FE")]
internal IList _crls;
// Token: 0x040078FF RID: 30975
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x40078FF")]
internal IList _signers;
// Token: 0x04007900 RID: 30976
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4007900")]
internal IDictionary _digests;
// Token: 0x04007901 RID: 30977
[FieldOffset(Offset = "0x30")]
[Token(Token = "0x4007901")]
internal bool _useDerForCerts;
// Token: 0x04007902 RID: 30978
[FieldOffset(Offset = "0x31")]
[Token(Token = "0x4007902")]
internal bool _useDerForCrls;
// Token: 0x04007903 RID: 30979
[FieldOffset(Offset = "0x38")]
[Token(Token = "0x4007903")]
protected readonly SecureRandom rand;
}
}