Files
Jan2021-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/X509/X509Crl.cs
T
2026-04-08 23:40:05 +02:00

527 lines
19 KiB
C#

using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Text;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Utilities;
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.Certificates;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Date;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Encoders;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509
{
// Token: 0x02001328 RID: 4904
[Token(Token = "0x2001328")]
[StructLayout(3)]
public class X509Crl : X509ExtensionBase
{
// Token: 0x06007B07 RID: 31495 RVA: 0x00199658 File Offset: 0x00197858
[Token(Token = "0x6007B07")]
[Address(RVA = "0x536970", Offset = "0x535370", VA = "0x180536970")]
public X509Crl(CertificateList c)
{
this.c = c;
string signatureName = X509SignatureUtilities.GetSignatureName(c.sigAlgID);
this.sigAlgName = signatureName;
DerObjectIdentifier objectID = c.sigAlgID.ObjectID;
if (objectID == 0)
{
this.sigAlgParams = objectID;
}
byte[] derEncoded = c.sigAlgID.ObjectID.GetDerEncoded();
this.sigAlgParams = derEncoded;
bool flag;
this.isIndirect = flag;
}
// Token: 0x06007B08 RID: 31496 RVA: 0x001996DC File Offset: 0x001978DC
[Token(Token = "0x6007B08")]
[Address(RVA = "0x5356C0", Offset = "0x5340C0", VA = "0x1805356C0", Slot = "8")]
protected override X509Extensions GetX509Extensions()
{
int version = this.c.Version;
return this.c.tbsCertList.crlExtensions;
}
// Token: 0x06007B09 RID: 31497 RVA: 0x00199710 File Offset: 0x00197910
[Token(Token = "0x6007B09")]
[Address(RVA = "0x5351D0", Offset = "0x533BD0", VA = "0x1805351D0", Slot = "13")]
public virtual byte[] GetEncoded()
{
return this.c.GetDerEncoded();
}
// Token: 0x06007B0A RID: 31498 RVA: 0x00199734 File Offset: 0x00197934
[Token(Token = "0x6007B0A")]
[Address(RVA = "0x536870", Offset = "0x535270", VA = "0x180536870", Slot = "14")]
public virtual void Verify(AsymmetricKeyParameter publicKey)
{
Asn1VerifierFactoryProvider asn1VerifierFactoryProvider = new Asn1VerifierFactoryProvider(publicKey);
ISet criticalExtensionOids = ((IX509Extension)this).GetCriticalExtensionOids();
}
// Token: 0x06007B0B RID: 31499 RVA: 0x00199750 File Offset: 0x00197950
[Token(Token = "0x6007B0B")]
[Address(RVA = "0x5368F0", Offset = "0x5352F0", VA = "0x1805368F0", Slot = "15")]
public virtual void Verify(IVerifierFactoryProvider verifierProvider)
{
CertificateList certificateList = this.c;
ISet criticalExtensionOids = ((IX509Extension)this).GetCriticalExtensionOids();
}
// Token: 0x06007B0C RID: 31500 RVA: 0x00199774 File Offset: 0x00197974
[Token(Token = "0x6007B0C")]
[Address(RVA = "0x534EA0", Offset = "0x5338A0", VA = "0x180534EA0", Slot = "16")]
protected virtual void CheckSignature(IVerifierFactory verifier)
{
/*
An exception occurred when decompiling this method (06007B0C)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.X509.X509Crl::CheckSignature(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IVerifierFactory)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_55:
stloc:CrlException(var_8_5F, newobj:CrlException(CrlException::.ctor, ldstr:string("Signature algorithm on CertificateList does not match TbsCertList.")))
}
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: 0x1700140E RID: 5134
// (get) Token: 0x06007B0D RID: 31501 RVA: 0x001997E4 File Offset: 0x001979E4
[Token(Token = "0x1700140E")]
public virtual int Version
{
[Token(Token = "0x6007B0D")]
[Address(RVA = "0x5329F0", Offset = "0x5313F0", VA = "0x1805329F0", Slot = "17")]
get
{
return this.c.Version;
}
}
// Token: 0x1700140F RID: 5135
// (get) Token: 0x06007B0E RID: 31502 RVA: 0x00199804 File Offset: 0x00197A04
[Token(Token = "0x1700140F")]
public virtual X509Name IssuerDN
{
[Token(Token = "0x6007B0E")]
[Address(RVA = "0x536C00", Offset = "0x535600", VA = "0x180536C00", Slot = "18")]
get
{
return this.c.Issuer;
}
}
// Token: 0x17001410 RID: 5136
// (get) Token: 0x06007B0F RID: 31503 RVA: 0x00199824 File Offset: 0x00197A24
[Token(Token = "0x17001410")]
public virtual DateTime ThisUpdate
{
[Token(Token = "0x6007B0F")]
[Address(RVA = "0x536CC0", Offset = "0x5356C0", VA = "0x180536CC0", Slot = "19")]
get
{
return this.c.ThisUpdate.ToDateTime();
}
}
// Token: 0x17001411 RID: 5137
// (get) Token: 0x06007B10 RID: 31504 RVA: 0x00199848 File Offset: 0x00197A48
[Token(Token = "0x17001411")]
public virtual DateTimeObject NextUpdate
{
[Token(Token = "0x6007B10")]
[Address(RVA = "0x536C20", Offset = "0x535620", VA = "0x180536C20", Slot = "20")]
get
{
if (this.c.NextUpdate == 0)
{
}
return new DateTimeObject(this.c.NextUpdate.ToDateTime());
}
}
// Token: 0x06007B11 RID: 31505 RVA: 0x00199880 File Offset: 0x00197A80
[Token(Token = "0x6007B11")]
[Address(RVA = "0x5357F0", Offset = "0x5341F0", VA = "0x1805357F0")]
private ISet LoadCrlEntries()
{
int num;
do
{
num = 0;
HashSet hashSet = new HashSet();
IEnumerable revokedCertificateEnumeration = this.c.GetRevokedCertificateEnumeration();
int version = this.Version;
if (version != 0)
{
if (num < version)
{
num += num;
num++;
}
bool flag = this.isIndirect;
if (version == 0)
{
}
if (version == 0)
{
goto IL_9D;
}
X509CrlEntry x509CrlEntry;
x509CrlEntry.c = version;
x509CrlEntry.isIndirect = flag;
x509CrlEntry.previousCertificateIssuer = version;
X509Name x509Name = x509CrlEntry.loadCertificateIssuer();
x509CrlEntry.certificateIssuer = x509Name;
uint num2;
if (num < (int)num2)
{
num += num;
num++;
}
x509CrlEntry += x509CrlEntry;
num += 19;
}
if (num != 0)
{
}
if (num != -1)
{
}
}
while (num != 0);
throw new NullReferenceException();
IL_9D:
throw new NullReferenceException();
}
// Token: 0x06007B12 RID: 31506 RVA: 0x00199930 File Offset: 0x00197B30
[Token(Token = "0x6007B12")]
[Address(RVA = "0x535280", Offset = "0x533C80", VA = "0x180535280", Slot = "21")]
public virtual X509CrlEntry GetRevokedCertificate(BigInteger serialNumber)
{
X509CrlEntry x509CrlEntry;
for (;;)
{
int num = 0;
IEnumerable enumerable;
if (enumerable != 0)
{
if (enumerable == 0)
{
}
if (enumerable == 0)
{
goto IL_6D;
}
x509CrlEntry.c = enumerable;
x509CrlEntry.isIndirect = num != 0;
x509CrlEntry.previousCertificateIssuer = enumerable;
X509Name x509Name = x509CrlEntry.loadCertificateIssuer();
x509CrlEntry.certificateIssuer = x509Name;
}
if (num != -1)
{
if (typeof(IDisposable).TypeHandle == (ulong)115L)
{
break;
}
if (typeof(IDisposable).TypeHandle == (ulong)113L)
{
goto IL_55;
}
}
if (num == 0)
{
goto IL_55;
}
}
return x509CrlEntry;
IL_55:
throw new NullReferenceException();
IL_6D:
throw new NullReferenceException();
}
// Token: 0x06007B13 RID: 31507 RVA: 0x001999B0 File Offset: 0x00197BB0
[Token(Token = "0x6007B13")]
[Address(RVA = "0x535530", Offset = "0x533F30", VA = "0x180535530", Slot = "22")]
public virtual ISet GetRevokedCertificates()
{
ISet set = this.LoadCrlEntries();
throw new NullReferenceException();
}
// Token: 0x06007B14 RID: 31508 RVA: 0x001999CC File Offset: 0x00197BCC
[Token(Token = "0x6007B14")]
[Address(RVA = "0x535600", Offset = "0x534000", VA = "0x180535600", Slot = "23")]
public virtual byte[] GetTbsCertList()
{
return this.c.tbsCertList.GetDerEncoded();
}
// Token: 0x06007B15 RID: 31509 RVA: 0x001999FC File Offset: 0x00197BFC
[Token(Token = "0x6007B15")]
[Address(RVA = "0x531510", Offset = "0x52FF10", VA = "0x180531510", Slot = "24")]
public virtual byte[] GetSignature()
{
return this.c.GetSignatureOctets();
}
// Token: 0x17001412 RID: 5138
// (get) Token: 0x06007B16 RID: 31510 RVA: 0x00199A1C File Offset: 0x00197C1C
[Token(Token = "0x17001412")]
public virtual string SigAlgName
{
[Token(Token = "0x6007B16")]
[Address(RVA = "0x3C1240", Offset = "0x3BFC40", VA = "0x1803C1240", Slot = "25")]
get
{
return this.sigAlgName;
}
}
// Token: 0x17001413 RID: 5139
// (get) Token: 0x06007B17 RID: 31511 RVA: 0x00199A30 File Offset: 0x00197C30
[Token(Token = "0x17001413")]
public virtual string SigAlgOid
{
[Token(Token = "0x6007B17")]
[Address(RVA = "0x532960", Offset = "0x531360", VA = "0x180532960", Slot = "26")]
get
{
Asn1Object asn1Object = this.c.sigAlgID.ToAsn1Object();
throw new NullReferenceException();
}
}
// Token: 0x06007B18 RID: 31512 RVA: 0x00199A54 File Offset: 0x00197C54
[Token(Token = "0x6007B18")]
[Address(RVA = "0x5355A0", Offset = "0x533FA0", VA = "0x1805355A0", Slot = "27")]
public virtual byte[] GetSigAlgParams()
{
return Arrays.Clone(this.sigAlgParams);
}
// Token: 0x06007B19 RID: 31513 RVA: 0x00199A6C File Offset: 0x00197C6C
[Token(Token = "0x6007B19")]
[Address(RVA = "0x535110", Offset = "0x533B10", VA = "0x180535110", Slot = "0")]
public override bool Equals(object obj)
{
if (obj != this)
{
if (obj != 0 && obj != 0)
{
Asn1Object asn1Object = this.c.ToAsn1Object();
}
}
return true;
}
// Token: 0x06007B1A RID: 31514 RVA: 0x00199A9C File Offset: 0x00197C9C
[Token(Token = "0x6007B1A")]
[Address(RVA = "0x528AC0", Offset = "0x5274C0", VA = "0x180528AC0", Slot = "2")]
public override int GetHashCode()
{
Asn1Object asn1Object = this.c.ToAsn1Object();
throw new NullReferenceException();
}
// Token: 0x06007B1B RID: 31515 RVA: 0x00199ABC File Offset: 0x00197CBC
[Token(Token = "0x6007B1B")]
[Address(RVA = "0x535B20", Offset = "0x534520", VA = "0x180535B20", Slot = "3")]
public override string ToString()
{
StringBuilder stringBuilder;
int num8;
do
{
int num = 0;
stringBuilder = new StringBuilder();
string newLine = Platform.NewLine;
StringBuilder stringBuilder2 = stringBuilder.Append(" Version: ");
StringBuilder stringBuilder4;
StringBuilder stringBuilder3 = stringBuilder4.Append(newLine);
StringBuilder stringBuilder5 = stringBuilder.Append(" IssuerDN: ");
int version = this.Version;
StringBuilder stringBuilder6 = stringBuilder5.Append(version).Append(newLine);
StringBuilder stringBuilder7 = stringBuilder.Append(" This update: ");
X509Name issuerDN = this.IssuerDN;
StringBuilder stringBuilder8 = stringBuilder7.Append(issuerDN).Append(newLine);
StringBuilder stringBuilder9 = stringBuilder.Append(" Next update: ");
DateTime thisUpdate = this.ThisUpdate;
StringBuilder stringBuilder10 = stringBuilder9.Append(thisUpdate).Append(newLine);
StringBuilder stringBuilder11 = stringBuilder.Append(" Signature Algorithm: ");
byte[] signature = this.GetSignature();
StringBuilder stringBuilder13;
StringBuilder stringBuilder12 = stringBuilder13.Append(newLine);
byte[] tbsCertList = this.GetTbsCertList();
StringBuilder stringBuilder14 = stringBuilder.Append(" Signature: ");
int num2 = 0;
string text = Hex.ToHexString(tbsCertList, num2, 20);
StringBuilder stringBuilder15 = stringBuilder.Append(text).Append(newLine);
int length = tbsCertList.Length;
uint num3;
if (num3 < (uint)length)
{
int num4 = tbsCertList.Length;
num4 -= (int)num3;
int num5 = Math.Min(20, num4);
StringBuilder stringBuilder16 = stringBuilder.Append(" ");
string text2 = Hex.ToHexString(tbsCertList, (int)num3, num5);
StringBuilder stringBuilder17 = stringBuilder.Append(text2).Append(newLine);
num3 += (uint)20;
}
X509Extensions crlExtensions = this.c.tbsCertList.crlExtensions;
if (crlExtensions != 0)
{
int num6;
if (crlExtensions.ExtensionOids != 0)
{
StringBuilder stringBuilder18 = stringBuilder.Append(" Extensions: ");
num6 = 0;
StringBuilder stringBuilder19 = stringBuilder18.Append(newLine);
}
if (num < num6)
{
num += num;
num++;
}
if (num == 0)
{
num++;
num += 19;
}
if (num == 0)
{
continue;
}
X509Extension extension = crlExtensions.GetExtension(num);
if (extension.value == 0)
{
StringBuilder stringBuilder20 = stringBuilder.Append(newLine);
}
StringBuilder stringBuilder21 = stringBuilder.Append(" critical(");
bool critical = extension.critical;
StringBuilder stringBuilder22 = stringBuilder21.Append(critical).Append(") ");
StringBuilder stringBuilder23 = stringBuilder.Append(" value = ");
Asn1Object asn1Object;
string text3 = Asn1Dump.DumpAsString(asn1Object);
CrlDistPoint instance = CrlDistPoint.GetInstance(stringBuilder23.Append(text3).Append(newLine));
CrlDistPoint instance2 = CrlDistPoint.GetInstance(stringBuilder.Append(instance).Append(newLine));
IssuingDistributionPoint instance3 = IssuingDistributionPoint.GetInstance(stringBuilder.Append(instance2).Append(newLine));
StringBuilder stringBuilder24 = stringBuilder.Append(instance3).Append(newLine);
CrlNumber crlNumber = new CrlNumber(DerInteger.GetInstance(asn1Object).PositiveValue);
string text4 = "Base CRL: " + crlNumber;
StringBuilder stringBuilder25 = stringBuilder.Append(text4).Append(newLine);
CrlNumber crlNumber2 = new CrlNumber(DerInteger.GetInstance(asn1Object).PositiveValue);
StringBuilder stringBuilder26 = stringBuilder.Append(crlNumber2).Append(newLine);
StringBuilder stringBuilder27 = stringBuilder.Append(" value = ").Append("*****");
int num7 = 0;
StringBuilder stringBuilder28 = stringBuilder27.Append(newLine);
num8 = 0;
if (num8 < num7)
{
num8 += num8;
num8++;
}
while (num8 != 0)
{
}
}
num8 += num8;
if (stringBuilder.Append(newLine) != 0)
{
}
if (num8 != -1)
{
}
}
while (num8 != 0);
int hashCode = stringBuilder.GetHashCode();
throw new NullReferenceException();
}
// Token: 0x06007B1C RID: 31516 RVA: 0x00199DE0 File Offset: 0x00197FE0
[Token(Token = "0x6007B1C")]
[Address(RVA = "0x535710", Offset = "0x534110", VA = "0x180535710", Slot = "28")]
public virtual bool IsRevoked(X509Certificate cert)
{
CrlEntry[] revokedCertificates = this.c.GetRevokedCertificates();
if (revokedCertificates != 0)
{
int version = cert.Version;
int num = 0;
int length = revokedCertificates.Length;
if (num < length)
{
if (revokedCertificates[num].userCertificate.Value == 0)
{
num++;
}
return true;
}
}
throw new NullReferenceException();
}
// Token: 0x17001414 RID: 5140
// (get) Token: 0x06007B1D RID: 31517 RVA: 0x00199E34 File Offset: 0x00198034
[Token(Token = "0x17001414")]
protected virtual bool IsIndirectCrl
{
[Token(Token = "0x6007B1D")]
[Address(RVA = "0x536AE0", Offset = "0x5354E0", VA = "0x180536AE0", Slot = "29")]
get
{
DerObjectIdentifier issuingDistributionPoint = X509Extensions.IssuingDistributionPoint;
ISet criticalExtensionOids = this.GetCriticalExtensionOids();
if (criticalExtensionOids != 0)
{
Asn1Object asn1Object;
IssuingDistributionPoint instance = IssuingDistributionPoint.GetInstance(asn1Object);
}
CrlException ex = new CrlException("Exception reading IssuingDistributionPoint" + issuingDistributionPoint);
throw new NullReferenceException();
}
}
// Token: 0x0400584A RID: 22602
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
[Token(Token = "0x400584A")]
private readonly CertificateList c;
// Token: 0x0400584B RID: 22603
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
[Token(Token = "0x400584B")]
private readonly string sigAlgName;
// Token: 0x0400584C RID: 22604
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
[Token(Token = "0x400584C")]
private readonly byte[] sigAlgParams;
// Token: 0x0400584D RID: 22605
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
[Token(Token = "0x400584D")]
private readonly bool isIndirect;
}
}