Files
Apr2020-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/X509/X509Crl.cs
T
niko 8fc35183db a
2026-04-11 22:19:20 +02:00

506 lines
18 KiB
C#

using System;
using System.Collections;
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: 0x02001905 RID: 6405
[Token(Token = "0x2001905")]
public class X509Crl : X509ExtensionBase
{
// Token: 0x060096E1 RID: 38625 RVA: 0x001F1030 File Offset: 0x001EF230
[Token(Token = "0x60096E1")]
[Address(RVA = "0x16317B0", Offset = "0x16305B0", VA = "0x1816317B0")]
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: 0x060096E2 RID: 38626 RVA: 0x001F10B4 File Offset: 0x001EF2B4
[Token(Token = "0x60096E2")]
[Address(RVA = "0x1630560", Offset = "0x162F360", VA = "0x181630560", Slot = "8")]
protected override X509Extensions GetX509Extensions()
{
int version = this.c.Version;
return this.c.tbsCertList.crlExtensions;
}
// Token: 0x060096E3 RID: 38627 RVA: 0x001F10E8 File Offset: 0x001EF2E8
[Token(Token = "0x60096E3")]
[Address(RVA = "0x1630080", Offset = "0x162EE80", VA = "0x181630080", Slot = "13")]
public virtual byte[] GetEncoded()
{
return this.c.GetDerEncoded();
}
// Token: 0x060096E4 RID: 38628 RVA: 0x001F110C File Offset: 0x001EF30C
[Token(Token = "0x60096E4")]
[Address(RVA = "0x16316B0", Offset = "0x16304B0", VA = "0x1816316B0", Slot = "14")]
public virtual void Verify(AsymmetricKeyParameter publicKey)
{
Asn1VerifierFactoryProvider asn1VerifierFactoryProvider = new Asn1VerifierFactoryProvider(publicKey);
ISet criticalExtensionOids = ((IX509Extension)this).GetCriticalExtensionOids();
}
// Token: 0x060096E5 RID: 38629 RVA: 0x001F1128 File Offset: 0x001EF328
[Token(Token = "0x60096E5")]
[Address(RVA = "0x1631730", Offset = "0x1630530", VA = "0x181631730", Slot = "15")]
public virtual void Verify(IVerifierFactoryProvider verifierProvider)
{
CertificateList certificateList = this.c;
ISet criticalExtensionOids = ((IX509Extension)this).GetCriticalExtensionOids();
}
// Token: 0x060096E6 RID: 38630 RVA: 0x001F114C File Offset: 0x001EF34C
[Token(Token = "0x60096E6")]
[Address(RVA = "0x162FD50", Offset = "0x162EB50", VA = "0x18162FD50", Slot = "16")]
protected virtual void CheckSignature(IVerifierFactory verifier)
{
/*
An exception occurred when decompiling this method (060096E6)
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 1660
*/;
}
// Token: 0x1700180F RID: 6159
// (get) Token: 0x060096E7 RID: 38631 RVA: 0x001F11BC File Offset: 0x001EF3BC
[Token(Token = "0x1700180F")]
public virtual int Version
{
[Token(Token = "0x60096E7")]
[Address(RVA = "0x1631B30", Offset = "0x1630930", VA = "0x181631B30", Slot = "17")]
get
{
return this.c.Version;
}
}
// Token: 0x17001810 RID: 6160
// (get) Token: 0x060096E8 RID: 38632 RVA: 0x001F11DC File Offset: 0x001EF3DC
[Token(Token = "0x17001810")]
public virtual X509Name IssuerDN
{
[Token(Token = "0x60096E8")]
[Address(RVA = "0x1631A40", Offset = "0x1630840", VA = "0x181631A40", Slot = "18")]
get
{
return this.c.Issuer;
}
}
// Token: 0x17001811 RID: 6161
// (get) Token: 0x060096E9 RID: 38633 RVA: 0x001F11FC File Offset: 0x001EF3FC
[Token(Token = "0x17001811")]
public virtual DateTime ThisUpdate
{
[Token(Token = "0x60096E9")]
[Address(RVA = "0x1631B00", Offset = "0x1630900", VA = "0x181631B00", Slot = "19")]
get
{
return this.c.ThisUpdate.ToDateTime();
}
}
// Token: 0x17001812 RID: 6162
// (get) Token: 0x060096EA RID: 38634 RVA: 0x001F1220 File Offset: 0x001EF420
[Token(Token = "0x17001812")]
public virtual DateTimeObject NextUpdate
{
[Token(Token = "0x60096EA")]
[Address(RVA = "0x1631A60", Offset = "0x1630860", VA = "0x181631A60", Slot = "20")]
get
{
if (this.c.NextUpdate == 0)
{
}
return new DateTimeObject(this.c.NextUpdate.ToDateTime());
}
}
// Token: 0x060096EB RID: 38635 RVA: 0x001F1258 File Offset: 0x001EF458
[Token(Token = "0x60096EB")]
[Address(RVA = "0x1630690", Offset = "0x162F490", VA = "0x181630690")]
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_99;
}
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)
{
}
}
while (num != 0);
throw new NullReferenceException();
IL_99:
throw new NullReferenceException();
}
// Token: 0x060096EC RID: 38636 RVA: 0x001F1304 File Offset: 0x001EF504
[Token(Token = "0x60096EC")]
[Address(RVA = "0x1630130", Offset = "0x162EF30", VA = "0x181630130", Slot = "21")]
public virtual X509CrlEntry GetRevokedCertificate(BigInteger serialNumber)
{
int num;
X509CrlEntry x509CrlEntry;
do
{
num = 0;
IEnumerable enumerable;
if (enumerable != 0)
{
if (enumerable == 0)
{
}
if (enumerable == 0)
{
goto IL_57;
}
x509CrlEntry.c = enumerable;
x509CrlEntry.isIndirect = num != 0;
x509CrlEntry.previousCertificateIssuer = enumerable;
X509Name x509Name = x509CrlEntry.loadCertificateIssuer();
x509CrlEntry.certificateIssuer = x509Name;
}
}
while (num != 0);
if (num != -1)
{
return x509CrlEntry;
}
throw new NullReferenceException();
IL_57:
throw new NullReferenceException();
}
// Token: 0x060096ED RID: 38637 RVA: 0x001F1370 File Offset: 0x001EF570
[Token(Token = "0x60096ED")]
[Address(RVA = "0x16303D0", Offset = "0x162F1D0", VA = "0x1816303D0", Slot = "22")]
public virtual ISet GetRevokedCertificates()
{
ISet set = this.LoadCrlEntries();
throw new NullReferenceException();
}
// Token: 0x060096EE RID: 38638 RVA: 0x001F138C File Offset: 0x001EF58C
[Token(Token = "0x60096EE")]
[Address(RVA = "0x16304A0", Offset = "0x162F2A0", VA = "0x1816304A0", Slot = "23")]
public virtual byte[] GetTbsCertList()
{
return this.c.tbsCertList.GetDerEncoded();
}
// Token: 0x060096EF RID: 38639 RVA: 0x001F13BC File Offset: 0x001EF5BC
[Token(Token = "0x60096EF")]
[Address(RVA = "0x162C470", Offset = "0x162B270", VA = "0x18162C470", Slot = "24")]
public virtual byte[] GetSignature()
{
return this.c.GetSignatureOctets();
}
// Token: 0x17001813 RID: 6163
// (get) Token: 0x060096F0 RID: 38640 RVA: 0x001F13DC File Offset: 0x001EF5DC
[Token(Token = "0x17001813")]
public virtual string SigAlgName
{
[Token(Token = "0x60096F0")]
[Address(RVA = "0x3F5F40", Offset = "0x3F4D40", VA = "0x1803F5F40", Slot = "25")]
get
{
return this.sigAlgName;
}
}
// Token: 0x17001814 RID: 6164
// (get) Token: 0x060096F1 RID: 38641 RVA: 0x001F13F0 File Offset: 0x001EF5F0
[Token(Token = "0x17001814")]
public virtual string SigAlgOid
{
[Token(Token = "0x60096F1")]
[Address(RVA = "0x162D8C0", Offset = "0x162C6C0", VA = "0x18162D8C0", Slot = "26")]
get
{
Asn1Object asn1Object = this.c.sigAlgID.ToAsn1Object();
throw new NullReferenceException();
}
}
// Token: 0x060096F2 RID: 38642 RVA: 0x001F1414 File Offset: 0x001EF614
[Token(Token = "0x60096F2")]
[Address(RVA = "0x1630440", Offset = "0x162F240", VA = "0x181630440", Slot = "27")]
public virtual byte[] GetSigAlgParams()
{
return Arrays.Clone(this.sigAlgParams);
}
// Token: 0x060096F3 RID: 38643 RVA: 0x001F142C File Offset: 0x001EF62C
[Token(Token = "0x60096F3")]
[Address(RVA = "0x162FFC0", Offset = "0x162EDC0", VA = "0x18162FFC0", Slot = "0")]
public override bool Equals(object obj)
{
if (obj != this)
{
if (obj != 0 && obj != 0)
{
Asn1Object asn1Object = this.c.ToAsn1Object();
}
}
return true;
}
// Token: 0x060096F4 RID: 38644 RVA: 0x001F145C File Offset: 0x001EF65C
[Token(Token = "0x60096F4")]
[Address(RVA = "0x4DA700", Offset = "0x4D9500", VA = "0x1804DA700", Slot = "2")]
public override int GetHashCode()
{
Asn1Object asn1Object = this.c.ToAsn1Object();
throw new NullReferenceException();
}
// Token: 0x060096F5 RID: 38645 RVA: 0x001F147C File Offset: 0x001EF67C
[Token(Token = "0x60096F5")]
[Address(RVA = "0x1630990", Offset = "0x162F790", VA = "0x181630990", Slot = "3")]
public override string ToString()
{
StringBuilder stringBuilder;
string newLine;
do
{
int num = 0;
stringBuilder = new StringBuilder();
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;
int num8;
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;
}
while (stringBuilder.Append(newLine) == 0 || 0 != 0);
int hashCode = stringBuilder.GetHashCode();
throw new NullReferenceException();
}
// Token: 0x060096F6 RID: 38646 RVA: 0x001F17A0 File Offset: 0x001EF9A0
[Token(Token = "0x60096F6")]
[Address(RVA = "0x16305B0", Offset = "0x162F3B0", VA = "0x1816305B0", 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: 0x17001815 RID: 6165
// (get) Token: 0x060096F7 RID: 38647 RVA: 0x001F17F4 File Offset: 0x001EF9F4
[Token(Token = "0x17001815")]
protected virtual bool IsIndirectCrl
{
[Token(Token = "0x60096F7")]
[Address(RVA = "0x1631920", Offset = "0x1630720", VA = "0x181631920", 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: 0x0400668D RID: 26253
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x400668D")]
private readonly CertificateList c;
// Token: 0x0400668E RID: 26254
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x400668E")]
private readonly string sigAlgName;
// Token: 0x0400668F RID: 26255
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x400668F")]
private readonly byte[] sigAlgParams;
// Token: 0x04006690 RID: 26256
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4006690")]
private readonly bool isIndirect;
}
}