388 lines
14 KiB
C#
388 lines
14 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
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: 0x02001770 RID: 6000
|
|
[Token(Token = "0x2001770")]
|
|
[StructLayout(3)]
|
|
public class CmsSignedGenerator
|
|
{
|
|
// Token: 0x0600A225 RID: 41509 RVA: 0x0025BD74 File Offset: 0x00259F74
|
|
[Token(Token = "0x600A225")]
|
|
[Address(RVA = "0x1C82470", Offset = "0x1C80E70", VA = "0x181C82470")]
|
|
protected CmsSignedGenerator()
|
|
{
|
|
SecureRandom secureRandom = new SecureRandom();
|
|
}
|
|
|
|
// Token: 0x0600A226 RID: 41510 RVA: 0x0025BD88 File Offset: 0x00259F88
|
|
[Token(Token = "0x600A226")]
|
|
[Address(RVA = "0x1C823E0", Offset = "0x1C80DE0", VA = "0x181C823E0")]
|
|
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: 0x0600A227 RID: 41511 RVA: 0x0025BDEC File Offset: 0x00259FEC
|
|
[Token(Token = "0x600A227")]
|
|
[Address(RVA = "0x1C81C80", Offset = "0x1C80680", VA = "0x181C81C80", Slot = "4")]
|
|
protected internal virtual IDictionary GetBaseParameters(DerObjectIdentifier contentType, AlgorithmIdentifier digAlgId, byte[] hash)
|
|
{
|
|
IDictionary dictionary = Platform.CreateHashtable();
|
|
if (contentType != 0)
|
|
{
|
|
}
|
|
return dictionary;
|
|
}
|
|
|
|
// Token: 0x0600A228 RID: 41512 RVA: 0x0025BE0C File Offset: 0x0025A00C
|
|
[Token(Token = "0x600A228")]
|
|
[Address(RVA = "0x1C81C10", Offset = "0x1C80610", VA = "0x181C81C10", Slot = "5")]
|
|
protected internal virtual Asn1Set GetAttributeSet(BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable attr)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600A228)
|
|
|
|
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: 0x0600A229 RID: 41513 RVA: 0x0025BE2C File Offset: 0x0025A02C
|
|
[Token(Token = "0x600A229")]
|
|
[Address(RVA = "0x1C81900", Offset = "0x1C80300", VA = "0x181C81900")]
|
|
public void AddCertificates(IX509Store certStore)
|
|
{
|
|
IList certs = this._certs;
|
|
IList certificatesFromStore = CmsUtilities.GetCertificatesFromStore(certStore);
|
|
CollectionUtilities.AddRange(certs, certificatesFromStore);
|
|
}
|
|
|
|
// Token: 0x0600A22A RID: 41514 RVA: 0x0025BE50 File Offset: 0x0025A050
|
|
[Token(Token = "0x600A22A")]
|
|
[Address(RVA = "0x1C81930", Offset = "0x1C80330", VA = "0x181C81930")]
|
|
public void AddCrls(IX509Store crlStore)
|
|
{
|
|
IList crls = this._crls;
|
|
IList crlsFromStore = CmsUtilities.GetCrlsFromStore(crlStore);
|
|
CollectionUtilities.AddRange(crls, crlsFromStore);
|
|
}
|
|
|
|
// Token: 0x0600A22B RID: 41515 RVA: 0x0025BE74 File Offset: 0x0025A074
|
|
[Token(Token = "0x600A22B")]
|
|
[Address(RVA = "0x1C81590", Offset = "0x1C7FF90", VA = "0x181C81590")]
|
|
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 != -1)
|
|
{
|
|
}
|
|
if (num == 0)
|
|
{
|
|
return;
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600A22C RID: 41516 RVA: 0x0025BF24 File Offset: 0x0025A124
|
|
[Token(Token = "0x600A22C")]
|
|
[Address(RVA = "0x1C81960", Offset = "0x1C80360", VA = "0x181C81960")]
|
|
public void AddSigners(SignerInformationStore signerStore)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
ICollection signers = signerStore.GetSigners();
|
|
Asn1Set attributeSet;
|
|
if (signers != 0)
|
|
{
|
|
if (num < signers)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
if (num == 0)
|
|
{
|
|
num++;
|
|
num += 19;
|
|
}
|
|
if (num == 0)
|
|
{
|
|
goto IL_60;
|
|
}
|
|
IList signers2 = this._signers;
|
|
if (num < num)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
attributeSet = this.GetAttributeSet(num);
|
|
num += num;
|
|
}
|
|
if (attributeSet != 0)
|
|
{
|
|
}
|
|
if (num != -1)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
return;
|
|
IL_60:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600A22D RID: 41517 RVA: 0x0025BF98 File Offset: 0x0025A198
|
|
[Token(Token = "0x600A22D")]
|
|
[Address(RVA = "0x1C81DD0", Offset = "0x1C807D0", VA = "0x181C81DD0")]
|
|
public IDictionary GetGeneratedDigests()
|
|
{
|
|
return Platform.CreateHashtable(this._digests);
|
|
}
|
|
|
|
// Token: 0x1700196C RID: 6508
|
|
// (get) Token: 0x0600A22E RID: 41518 RVA: 0x0025BFB0 File Offset: 0x0025A1B0
|
|
// (set) Token: 0x0600A22F RID: 41519 RVA: 0x0025BFC4 File Offset: 0x0025A1C4
|
|
[Token(Token = "0x1700196C")]
|
|
public bool UseDerForCerts
|
|
{
|
|
[Token(Token = "0x600A22E")]
|
|
[Address(RVA = "0x4CB2D0", Offset = "0x4C9CD0", VA = "0x1804CB2D0")]
|
|
get
|
|
{
|
|
return this._useDerForCerts;
|
|
}
|
|
[Token(Token = "0x600A22F")]
|
|
[Address(RVA = "0x4CB340", Offset = "0x4C9D40", VA = "0x1804CB340")]
|
|
set
|
|
{
|
|
this._useDerForCerts = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700196D RID: 6509
|
|
// (get) Token: 0x0600A230 RID: 41520 RVA: 0x0025BFD8 File Offset: 0x0025A1D8
|
|
// (set) Token: 0x0600A231 RID: 41521 RVA: 0x0025BFEC File Offset: 0x0025A1EC
|
|
[Token(Token = "0x1700196D")]
|
|
public bool UseDerForCrls
|
|
{
|
|
[Token(Token = "0x600A230")]
|
|
[Address(RVA = "0x727170", Offset = "0x725B70", VA = "0x180727170")]
|
|
get
|
|
{
|
|
return this._useDerForCrls;
|
|
}
|
|
[Token(Token = "0x600A231")]
|
|
[Address(RVA = "0x7273B0", Offset = "0x725DB0", VA = "0x1807273B0")]
|
|
set
|
|
{
|
|
this._useDerForCrls = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600A232 RID: 41522 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x600A232")]
|
|
[Address(RVA = "0x3C9F60", Offset = "0x3C8960", VA = "0x1803C9F60", Slot = "6")]
|
|
internal virtual void AddSignerCallback(SignerInformation si)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x0600A233 RID: 41523 RVA: 0x0025C000 File Offset: 0x0025A200
|
|
[Token(Token = "0x600A233")]
|
|
[Address(RVA = "0x1C81E30", Offset = "0x1C80830", VA = "0x181C81E30")]
|
|
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: 0x0600A234 RID: 41524 RVA: 0x0025C048 File Offset: 0x0025A248
|
|
[Token(Token = "0x600A234")]
|
|
[Address(RVA = "0x1C81F20", Offset = "0x1C80920", VA = "0x181C81F20")]
|
|
internal static SignerIdentifier GetSignerIdentifier(byte[] subjectKeyIdentifier)
|
|
{
|
|
return new SignerIdentifier(new DerOctetString(subjectKeyIdentifier));
|
|
}
|
|
|
|
// Token: 0x04006AA9 RID: 27305
|
|
[Token(Token = "0x4006AA9")]
|
|
public static readonly string Data = CmsObjectIdentifiers.Data.identifier;
|
|
|
|
// Token: 0x04006AAA RID: 27306
|
|
[Token(Token = "0x4006AAA")]
|
|
public static readonly string DigestSha1 = OiwObjectIdentifiers.IdSha1.identifier;
|
|
|
|
// Token: 0x04006AAB RID: 27307
|
|
[Token(Token = "0x4006AAB")]
|
|
public static readonly string DigestSha224 = NistObjectIdentifiers.IdSha224.identifier;
|
|
|
|
// Token: 0x04006AAC RID: 27308
|
|
[Token(Token = "0x4006AAC")]
|
|
public static readonly string DigestSha256 = NistObjectIdentifiers.IdSha256.identifier;
|
|
|
|
// Token: 0x04006AAD RID: 27309
|
|
[Token(Token = "0x4006AAD")]
|
|
public static readonly string DigestSha384 = NistObjectIdentifiers.IdSha384.identifier;
|
|
|
|
// Token: 0x04006AAE RID: 27310
|
|
[Token(Token = "0x4006AAE")]
|
|
public static readonly string DigestSha512 = NistObjectIdentifiers.IdSha512.identifier;
|
|
|
|
// Token: 0x04006AAF RID: 27311
|
|
[Token(Token = "0x4006AAF")]
|
|
public static readonly string DigestMD5 = PkcsObjectIdentifiers.MD5.identifier;
|
|
|
|
// Token: 0x04006AB0 RID: 27312
|
|
[Token(Token = "0x4006AB0")]
|
|
public static readonly string DigestGost3411 = CryptoProObjectIdentifiers.GostR3411.identifier;
|
|
|
|
// Token: 0x04006AB1 RID: 27313
|
|
[Token(Token = "0x4006AB1")]
|
|
public static readonly string DigestRipeMD128 = TeleTrusTObjectIdentifiers.RipeMD128.identifier;
|
|
|
|
// Token: 0x04006AB2 RID: 27314
|
|
[Token(Token = "0x4006AB2")]
|
|
public static readonly string DigestRipeMD160 = TeleTrusTObjectIdentifiers.RipeMD160.identifier;
|
|
|
|
// Token: 0x04006AB3 RID: 27315
|
|
[Token(Token = "0x4006AB3")]
|
|
public static readonly string DigestRipeMD256 = TeleTrusTObjectIdentifiers.RipeMD256.identifier;
|
|
|
|
// Token: 0x04006AB4 RID: 27316
|
|
[Token(Token = "0x4006AB4")]
|
|
public static readonly string EncryptionRsa = PkcsObjectIdentifiers.RsaEncryption.identifier;
|
|
|
|
// Token: 0x04006AB5 RID: 27317
|
|
[Token(Token = "0x4006AB5")]
|
|
public static readonly string EncryptionDsa = X9ObjectIdentifiers.IdDsaWithSha1.identifier;
|
|
|
|
// Token: 0x04006AB6 RID: 27318
|
|
[Token(Token = "0x4006AB6")]
|
|
public static readonly string EncryptionECDsa = X9ObjectIdentifiers.ECDsaWithSha1.identifier;
|
|
|
|
// Token: 0x04006AB7 RID: 27319
|
|
[Token(Token = "0x4006AB7")]
|
|
public static readonly string EncryptionRsaPss = PkcsObjectIdentifiers.IdRsassaPss.identifier;
|
|
|
|
// Token: 0x04006AB8 RID: 27320
|
|
[Token(Token = "0x4006AB8")]
|
|
public static readonly string EncryptionGost3410 = CryptoProObjectIdentifiers.GostR3410x94.identifier;
|
|
|
|
// Token: 0x04006AB9 RID: 27321
|
|
[Token(Token = "0x4006AB9")]
|
|
public static readonly string EncryptionECGost3410 = CryptoProObjectIdentifiers.GostR3410x2001.identifier;
|
|
|
|
// Token: 0x04006ABA RID: 27322
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006ABA")]
|
|
internal IList _certs;
|
|
|
|
// Token: 0x04006ABB RID: 27323
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006ABB")]
|
|
internal IList _crls;
|
|
|
|
// Token: 0x04006ABC RID: 27324
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006ABC")]
|
|
internal IList _signers;
|
|
|
|
// Token: 0x04006ABD RID: 27325
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4006ABD")]
|
|
internal IDictionary _digests;
|
|
|
|
// Token: 0x04006ABE RID: 27326
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4006ABE")]
|
|
internal bool _useDerForCerts;
|
|
|
|
// Token: 0x04006ABF RID: 27327
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x31")]
|
|
[Token(Token = "0x4006ABF")]
|
|
internal bool _useDerForCrls;
|
|
|
|
// Token: 0x04006AC0 RID: 27328
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4006AC0")]
|
|
protected readonly SecureRandom rand;
|
|
}
|
|
}
|