311 lines
13 KiB
C#
311 lines
13 KiB
C#
using System;
|
|
using System.Collections;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Operators;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509
|
|
{
|
|
// Token: 0x020019EF RID: 6639
|
|
[Token(Token = "0x20019EF")]
|
|
public class X509V2CrlGenerator
|
|
{
|
|
// Token: 0x06009B28 RID: 39720 RVA: 0x001FC120 File Offset: 0x001FA320
|
|
[Token(Token = "0x6009B28")]
|
|
[Address(RVA = "0x63D280", Offset = "0x63C280", VA = "0x18063D280")]
|
|
public X509V2CrlGenerator()
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = new X509ExtensionsGenerator();
|
|
this.extGenerator = x509ExtensionsGenerator;
|
|
base..ctor();
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = new V2TbsCertListGenerator();
|
|
this.tbsGen = v2TbsCertListGenerator;
|
|
}
|
|
|
|
// Token: 0x06009B29 RID: 39721 RVA: 0x001FC150 File Offset: 0x001FA350
|
|
[Token(Token = "0x6009B29")]
|
|
[Address(RVA = "0x63D000", Offset = "0x63C000", VA = "0x18063D000")]
|
|
public void Reset()
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = new V2TbsCertListGenerator();
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
this.tbsGen = v2TbsCertListGenerator;
|
|
x509ExtensionsGenerator.Reset();
|
|
}
|
|
|
|
// Token: 0x06009B2A RID: 39722 RVA: 0x001FC180 File Offset: 0x001FA380
|
|
[Token(Token = "0x6009B2A")]
|
|
[Address(RVA = "0x63D070", Offset = "0x63C070", VA = "0x18063D070")]
|
|
public void SetIssuerDN(X509Name issuer)
|
|
{
|
|
this.tbsGen.issuer = issuer;
|
|
}
|
|
|
|
// Token: 0x06009B2B RID: 39723 RVA: 0x001FC1A0 File Offset: 0x001FA3A0
|
|
[Token(Token = "0x6009B2B")]
|
|
[Address(RVA = "0x63D210", Offset = "0x63C210", VA = "0x18063D210")]
|
|
public void SetThisUpdate(DateTime date)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
Time time = new Time(date);
|
|
v2TbsCertListGenerator.thisUpdate = time;
|
|
}
|
|
|
|
// Token: 0x06009B2C RID: 39724 RVA: 0x001FC1C8 File Offset: 0x001FA3C8
|
|
[Token(Token = "0x6009B2C")]
|
|
[Address(RVA = "0x63D090", Offset = "0x63C090", VA = "0x18063D090")]
|
|
public void SetNextUpdate(DateTime date)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
Time time = new Time(date);
|
|
v2TbsCertListGenerator.nextUpdate = time;
|
|
}
|
|
|
|
// Token: 0x06009B2D RID: 39725 RVA: 0x001FC1F0 File Offset: 0x001FA3F0
|
|
[Token(Token = "0x6009B2D")]
|
|
[Address(RVA = "0x63C3E0", Offset = "0x63B3E0", VA = "0x18063C3E0")]
|
|
public void AddCrlEntry(BigInteger userCertificate, DateTime revocationDate, int reason)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
DerInteger derInteger = new DerInteger(userCertificate);
|
|
Time time = new Time(revocationDate);
|
|
v2TbsCertListGenerator.AddCrlEntry(derInteger, time, reason);
|
|
}
|
|
|
|
// Token: 0x06009B2E RID: 39726 RVA: 0x001FC224 File Offset: 0x001FA424
|
|
[Token(Token = "0x6009B2E")]
|
|
[Address(RVA = "0x63C4A0", Offset = "0x63B4A0", VA = "0x18063C4A0")]
|
|
public void AddCrlEntry(BigInteger userCertificate, DateTime revocationDate, int reason, DateTime invalidityDate)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
DerInteger derInteger = new DerInteger(userCertificate);
|
|
Time time = new Time(revocationDate);
|
|
}
|
|
|
|
// Token: 0x06009B2F RID: 39727 RVA: 0x001FC24C File Offset: 0x001FA44C
|
|
[Token(Token = "0x6009B2F")]
|
|
[Address(RVA = "0x63C320", Offset = "0x63B320", VA = "0x18063C320")]
|
|
public void AddCrlEntry(BigInteger userCertificate, DateTime revocationDate, X509Extensions extensions)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
DerInteger derInteger = new DerInteger(userCertificate);
|
|
Time time = new Time(revocationDate);
|
|
v2TbsCertListGenerator.AddCrlEntry(derInteger, time, extensions);
|
|
}
|
|
|
|
// Token: 0x06009B30 RID: 39728 RVA: 0x001FC280 File Offset: 0x001FA480
|
|
[Token(Token = "0x6009B30")]
|
|
[Address(RVA = "0x63C590", Offset = "0x63B590", VA = "0x18063C590")]
|
|
public void AddCrl(X509Crl other)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009B30)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.X509.X509V2CrlGenerator::AddCrl(BestHTTP.SecureProtocol.Org.BouncyCastle.X509.X509Crl)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_48:
|
|
stloc:ArgumentNullException(var_5_52, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("other")))
|
|
}
|
|
|
|
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: 0x06009B31 RID: 39729 RVA: 0x001FC2E0 File Offset: 0x001FA4E0
|
|
[Token(Token = "0x6009B31")]
|
|
[Address(RVA = "0x63D100", Offset = "0x63C100", VA = "0x18063D100")]
|
|
[Obsolete]
|
|
public void SetSignatureAlgorithm(string signatureAlgorithm)
|
|
{
|
|
this.signatureAlgorithm = signatureAlgorithm;
|
|
DerObjectIdentifier algorithmOid = X509Utilities.GetAlgorithmOid(signatureAlgorithm);
|
|
this.sigOID = algorithmOid;
|
|
AlgorithmIdentifier sigAlgID = X509Utilities.GetSigAlgID(algorithmOid, signatureAlgorithm);
|
|
this.sigAlgId = sigAlgID;
|
|
this.tbsGen.signature = sigAlgID;
|
|
}
|
|
|
|
// Token: 0x06009B32 RID: 39730 RVA: 0x001FC32C File Offset: 0x001FA52C
|
|
[Token(Token = "0x6009B32")]
|
|
[Address(RVA = "0x63C920", Offset = "0x63B920", VA = "0x18063C920")]
|
|
public void AddExtension(string oid, bool critical, Asn1Encodable extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06009B33 RID: 39731 RVA: 0x001FC358 File Offset: 0x001FA558
|
|
[Token(Token = "0x6009B33")]
|
|
[Address(RVA = "0x63C780", Offset = "0x63B780", VA = "0x18063C780")]
|
|
public void AddExtension(DerObjectIdentifier oid, bool critical, Asn1Encodable extensionValue)
|
|
{
|
|
this.extGenerator.AddExtension(oid, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06009B34 RID: 39732 RVA: 0x001FC37C File Offset: 0x001FA57C
|
|
[Token(Token = "0x6009B34")]
|
|
[Address(RVA = "0x63C860", Offset = "0x63B860", VA = "0x18063C860")]
|
|
public void AddExtension(string oid, bool critical, byte[] extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
DerOctetString derOctetString = new DerOctetString(extensionValue);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, derOctetString);
|
|
}
|
|
|
|
// Token: 0x06009B35 RID: 39733 RVA: 0x001FC3B0 File Offset: 0x001FA5B0
|
|
[Token(Token = "0x6009B35")]
|
|
[Address(RVA = "0x63C7B0", Offset = "0x63B7B0", VA = "0x18063C7B0")]
|
|
public void AddExtension(DerObjectIdentifier oid, bool critical, byte[] extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerOctetString derOctetString = new DerOctetString(extensionValue);
|
|
x509ExtensionsGenerator.AddExtension(oid, critical, derOctetString);
|
|
}
|
|
|
|
// Token: 0x06009B36 RID: 39734 RVA: 0x001FC3DC File Offset: 0x001FA5DC
|
|
[Token(Token = "0x6009B36")]
|
|
[Address(RVA = "0x63CF70", Offset = "0x63BF70", VA = "0x18063CF70")]
|
|
[Obsolete]
|
|
public X509Crl Generate(AsymmetricKeyParameter privateKey)
|
|
{
|
|
int num;
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, num);
|
|
num = 0;
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06009B37 RID: 39735 RVA: 0x001FC400 File Offset: 0x001FA600
|
|
[Token(Token = "0x6009B37")]
|
|
[Address(RVA = "0x63CBF0", Offset = "0x63BBF0", VA = "0x18063CBF0")]
|
|
[Obsolete]
|
|
public X509Crl Generate(AsymmetricKeyParameter privateKey, SecureRandom random)
|
|
{
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, random);
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06009B38 RID: 39736 RVA: 0x001FC424 File Offset: 0x001FA624
|
|
[Token(Token = "0x6009B38")]
|
|
[Address(RVA = "0x63CC90", Offset = "0x63BC90", VA = "0x18063CC90")]
|
|
public X509Crl Generate(ISignatureFactory signatureCalculatorFactory)
|
|
{
|
|
for (;;)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
if (signatureCalculatorFactory != 0)
|
|
{
|
|
if (!this.extGenerator.IsEmpty)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
V2TbsCertListGenerator v2TbsCertListGenerator2 = this.tbsGen;
|
|
X509Extensions x509Extensions = x509ExtensionsGenerator.Generate();
|
|
v2TbsCertListGenerator2.extensions = x509Extensions;
|
|
}
|
|
byte[] derEncoded = this.tbsGen.GenerateTbsCertList().GetDerEncoded();
|
|
if (derEncoded != 0 && derEncoded != 0)
|
|
{
|
|
if (derEncoded == 0)
|
|
{
|
|
}
|
|
if (derEncoded != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
X509Crl x509Crl;
|
|
return x509Crl;
|
|
}
|
|
|
|
// Token: 0x06009B39 RID: 39737 RVA: 0x001FC4A8 File Offset: 0x001FA6A8
|
|
[Token(Token = "0x6009B39")]
|
|
[Address(RVA = "0x63C9D0", Offset = "0x63B9D0", VA = "0x18063C9D0")]
|
|
private TbsCertificateList GenerateCertList()
|
|
{
|
|
if (!this.extGenerator.IsEmpty)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
X509Extensions x509Extensions = x509ExtensionsGenerator.Generate();
|
|
v2TbsCertListGenerator.extensions = x509Extensions;
|
|
}
|
|
return this.tbsGen.GenerateTbsCertList();
|
|
}
|
|
|
|
// Token: 0x06009B3A RID: 39738 RVA: 0x001FC4F0 File Offset: 0x001FA6F0
|
|
[Token(Token = "0x6009B3A")]
|
|
[Address(RVA = "0x63CA30", Offset = "0x63BA30", VA = "0x18063CA30")]
|
|
private X509Crl GenerateJcaObject(TbsCertificateList tbsCrl, AlgorithmIdentifier algId, byte[] signature)
|
|
{
|
|
Asn1Encodable[] array = new Asn1Encodable[3];
|
|
if (tbsCrl != 0)
|
|
{
|
|
}
|
|
array[0] = tbsCrl;
|
|
if (algId != 0)
|
|
{
|
|
}
|
|
array[1] = algId;
|
|
DerBitString derBitString = new DerBitString(signature);
|
|
if (derBitString != 0)
|
|
{
|
|
}
|
|
array[2] = derBitString;
|
|
return new X509Crl(CertificateList.GetInstance(new DerSequence(array)));
|
|
}
|
|
|
|
// Token: 0x170018C0 RID: 6336
|
|
// (get) Token: 0x06009B3B RID: 39739 RVA: 0x001FC548 File Offset: 0x001FA748
|
|
[Token(Token = "0x170018C0")]
|
|
public IEnumerable SignatureAlgNames
|
|
{
|
|
[Token(Token = "0x6009B3B")]
|
|
[Address(RVA = "0x63D300", Offset = "0x63C300", VA = "0x18063D300")]
|
|
get
|
|
{
|
|
return X509Utilities.GetAlgNames();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0400686D RID: 26733
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400686D")]
|
|
private readonly X509ExtensionsGenerator extGenerator;
|
|
|
|
// Token: 0x0400686E RID: 26734
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400686E")]
|
|
private V2TbsCertListGenerator tbsGen;
|
|
|
|
// Token: 0x0400686F RID: 26735
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400686F")]
|
|
private DerObjectIdentifier sigOID;
|
|
|
|
// Token: 0x04006870 RID: 26736
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4006870")]
|
|
private AlgorithmIdentifier sigAlgId;
|
|
|
|
// Token: 0x04006871 RID: 26737
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4006871")]
|
|
private string signatureAlgorithm;
|
|
}
|
|
}
|