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: 0x0200190F RID: 6415
|
|
[Token(Token = "0x200190F")]
|
|
public class X509V2CrlGenerator
|
|
{
|
|
// Token: 0x0600975A RID: 38746 RVA: 0x001F3088 File Offset: 0x001F1288
|
|
[Token(Token = "0x600975A")]
|
|
[Address(RVA = "0x1C49B80", Offset = "0x1C48980", VA = "0x181C49B80")]
|
|
public X509V2CrlGenerator()
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = new X509ExtensionsGenerator();
|
|
this.extGenerator = x509ExtensionsGenerator;
|
|
base..ctor();
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = new V2TbsCertListGenerator();
|
|
this.tbsGen = v2TbsCertListGenerator;
|
|
}
|
|
|
|
// Token: 0x0600975B RID: 38747 RVA: 0x001F30B8 File Offset: 0x001F12B8
|
|
[Token(Token = "0x600975B")]
|
|
[Address(RVA = "0x1C49900", Offset = "0x1C48700", VA = "0x181C49900")]
|
|
public void Reset()
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = new V2TbsCertListGenerator();
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
this.tbsGen = v2TbsCertListGenerator;
|
|
x509ExtensionsGenerator.Reset();
|
|
}
|
|
|
|
// Token: 0x0600975C RID: 38748 RVA: 0x001F30E8 File Offset: 0x001F12E8
|
|
[Token(Token = "0x600975C")]
|
|
[Address(RVA = "0x1C49970", Offset = "0x1C48770", VA = "0x181C49970")]
|
|
public void SetIssuerDN(X509Name issuer)
|
|
{
|
|
this.tbsGen.issuer = issuer;
|
|
}
|
|
|
|
// Token: 0x0600975D RID: 38749 RVA: 0x001F3108 File Offset: 0x001F1308
|
|
[Token(Token = "0x600975D")]
|
|
[Address(RVA = "0x1C49B10", Offset = "0x1C48910", VA = "0x181C49B10")]
|
|
public void SetThisUpdate(DateTime date)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
Time time = new Time(date);
|
|
v2TbsCertListGenerator.thisUpdate = time;
|
|
}
|
|
|
|
// Token: 0x0600975E RID: 38750 RVA: 0x001F3130 File Offset: 0x001F1330
|
|
[Token(Token = "0x600975E")]
|
|
[Address(RVA = "0x1C49990", Offset = "0x1C48790", VA = "0x181C49990")]
|
|
public void SetNextUpdate(DateTime date)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
Time time = new Time(date);
|
|
v2TbsCertListGenerator.nextUpdate = time;
|
|
}
|
|
|
|
// Token: 0x0600975F RID: 38751 RVA: 0x001F3158 File Offset: 0x001F1358
|
|
[Token(Token = "0x600975F")]
|
|
[Address(RVA = "0x1C48CE0", Offset = "0x1C47AE0", VA = "0x181C48CE0")]
|
|
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: 0x06009760 RID: 38752 RVA: 0x001F318C File Offset: 0x001F138C
|
|
[Token(Token = "0x6009760")]
|
|
[Address(RVA = "0x1C48DA0", Offset = "0x1C47BA0", VA = "0x181C48DA0")]
|
|
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: 0x06009761 RID: 38753 RVA: 0x001F31B4 File Offset: 0x001F13B4
|
|
[Token(Token = "0x6009761")]
|
|
[Address(RVA = "0x1C48C20", Offset = "0x1C47A20", VA = "0x181C48C20")]
|
|
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: 0x06009762 RID: 38754 RVA: 0x001F31E8 File Offset: 0x001F13E8
|
|
[Token(Token = "0x6009762")]
|
|
[Address(RVA = "0x1C48E90", Offset = "0x1C47C90", VA = "0x181C48E90")]
|
|
public void AddCrl(X509Crl other)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009762)
|
|
|
|
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: 0x06009763 RID: 38755 RVA: 0x001F3248 File Offset: 0x001F1448
|
|
[Token(Token = "0x6009763")]
|
|
[Address(RVA = "0x1C49A00", Offset = "0x1C48800", VA = "0x181C49A00")]
|
|
[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: 0x06009764 RID: 38756 RVA: 0x001F3294 File Offset: 0x001F1494
|
|
[Token(Token = "0x6009764")]
|
|
[Address(RVA = "0x1C49220", Offset = "0x1C48020", VA = "0x181C49220")]
|
|
public void AddExtension(string oid, bool critical, Asn1Encodable extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06009765 RID: 38757 RVA: 0x001F32C0 File Offset: 0x001F14C0
|
|
[Token(Token = "0x6009765")]
|
|
[Address(RVA = "0x1C49080", Offset = "0x1C47E80", VA = "0x181C49080")]
|
|
public void AddExtension(DerObjectIdentifier oid, bool critical, Asn1Encodable extensionValue)
|
|
{
|
|
this.extGenerator.AddExtension(oid, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06009766 RID: 38758 RVA: 0x001F32E4 File Offset: 0x001F14E4
|
|
[Token(Token = "0x6009766")]
|
|
[Address(RVA = "0x1C49160", Offset = "0x1C47F60", VA = "0x181C49160")]
|
|
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: 0x06009767 RID: 38759 RVA: 0x001F3318 File Offset: 0x001F1518
|
|
[Token(Token = "0x6009767")]
|
|
[Address(RVA = "0x1C490B0", Offset = "0x1C47EB0", VA = "0x181C490B0")]
|
|
public void AddExtension(DerObjectIdentifier oid, bool critical, byte[] extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerOctetString derOctetString = new DerOctetString(extensionValue);
|
|
x509ExtensionsGenerator.AddExtension(oid, critical, derOctetString);
|
|
}
|
|
|
|
// Token: 0x06009768 RID: 38760 RVA: 0x001F3344 File Offset: 0x001F1544
|
|
[Token(Token = "0x6009768")]
|
|
[Address(RVA = "0x1C49870", Offset = "0x1C48670", VA = "0x181C49870")]
|
|
[Obsolete]
|
|
public X509Crl Generate(AsymmetricKeyParameter privateKey)
|
|
{
|
|
int num;
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, num);
|
|
num = 0;
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06009769 RID: 38761 RVA: 0x001F3368 File Offset: 0x001F1568
|
|
[Token(Token = "0x6009769")]
|
|
[Address(RVA = "0x1C494F0", Offset = "0x1C482F0", VA = "0x181C494F0")]
|
|
[Obsolete]
|
|
public X509Crl Generate(AsymmetricKeyParameter privateKey, SecureRandom random)
|
|
{
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, random);
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x0600976A RID: 38762 RVA: 0x001F338C File Offset: 0x001F158C
|
|
[Token(Token = "0x600976A")]
|
|
[Address(RVA = "0x1C49590", Offset = "0x1C48390", VA = "0x181C49590")]
|
|
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: 0x0600976B RID: 38763 RVA: 0x001F3410 File Offset: 0x001F1610
|
|
[Token(Token = "0x600976B")]
|
|
[Address(RVA = "0x1C492D0", Offset = "0x1C480D0", VA = "0x181C492D0")]
|
|
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: 0x0600976C RID: 38764 RVA: 0x001F3458 File Offset: 0x001F1658
|
|
[Token(Token = "0x600976C")]
|
|
[Address(RVA = "0x1C49330", Offset = "0x1C48130", VA = "0x181C49330")]
|
|
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: 0x17001823 RID: 6179
|
|
// (get) Token: 0x0600976D RID: 38765 RVA: 0x001F34B0 File Offset: 0x001F16B0
|
|
[Token(Token = "0x17001823")]
|
|
public IEnumerable SignatureAlgNames
|
|
{
|
|
[Token(Token = "0x600976D")]
|
|
[Address(RVA = "0x1C49C00", Offset = "0x1C48A00", VA = "0x181C49C00")]
|
|
get
|
|
{
|
|
return X509Utilities.GetAlgNames();
|
|
}
|
|
}
|
|
|
|
// Token: 0x040066B4 RID: 26292
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40066B4")]
|
|
private readonly X509ExtensionsGenerator extGenerator;
|
|
|
|
// Token: 0x040066B5 RID: 26293
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40066B5")]
|
|
private V2TbsCertListGenerator tbsGen;
|
|
|
|
// Token: 0x040066B6 RID: 26294
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40066B6")]
|
|
private DerObjectIdentifier sigOID;
|
|
|
|
// Token: 0x040066B7 RID: 26295
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40066B7")]
|
|
private AlgorithmIdentifier sigAlgId;
|
|
|
|
// Token: 0x040066B8 RID: 26296
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40066B8")]
|
|
private string signatureAlgorithm;
|
|
}
|
|
}
|