Files
niko c12fbe3fc6 m
2026-04-12 16:51:38 +02:00

312 lines
11 KiB
C#

using System;
using System.Collections;
using System.IO;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ocsp;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Store;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Ocsp
{
// Token: 0x02001AA6 RID: 6822
[Token(Token = "0x2001AA6")]
public class OcspReq : X509ExtensionBase
{
// Token: 0x0600A17B RID: 41339 RVA: 0x0021A03C File Offset: 0x0021823C
[Token(Token = "0x600A17B")]
[Address(RVA = "0x681CA0", Offset = "0x680CA0", VA = "0x180681CA0")]
public OcspReq(OcspRequest req)
{
this.req = req;
}
// Token: 0x0600A17C RID: 41340 RVA: 0x0021A058 File Offset: 0x00218258
[Token(Token = "0x600A17C")]
[Address(RVA = "0xD02520", Offset = "0xD01520", VA = "0x180D02520")]
public OcspReq(byte[] req)
{
Asn1InputStream asn1InputStream = new Asn1InputStream(req);
}
// Token: 0x0600A17D RID: 41341 RVA: 0x0021A06C File Offset: 0x0021826C
[Token(Token = "0x600A17D")]
[Address(RVA = "0xD024B0", Offset = "0xD014B0", VA = "0x180D024B0")]
public OcspReq(Stream inStr)
{
Asn1InputStream asn1InputStream = new Asn1InputStream(inStr);
}
// Token: 0x0600A17E RID: 41342 RVA: 0x0021A080 File Offset: 0x00218280
[Token(Token = "0x600A17E")]
[Address(RVA = "0xD02590", Offset = "0xD01590", VA = "0x180D02590")]
private OcspReq(Asn1InputStream aIn)
{
OcspRequest instance = OcspRequest.GetInstance(aIn.ReadObject());
this.req = instance;
}
// Token: 0x0600A17F RID: 41343 RVA: 0x0021A0BC File Offset: 0x002182BC
[Token(Token = "0x600A17F")]
[Address(RVA = "0xD02140", Offset = "0xD01140", VA = "0x180D02140")]
public byte[] GetTbsRequest()
{
return this.req.tbsRequest.GetEncoded();
}
// Token: 0x170019B1 RID: 6577
// (get) Token: 0x0600A180 RID: 41344 RVA: 0x0021A0E8 File Offset: 0x002182E8
[Token(Token = "0x170019B1")]
public int Version
{
[Token(Token = "0x600A180")]
[Address(RVA = "0x423EF0", Offset = "0x422EF0", VA = "0x180423EF0")]
get
{
int intValue = this.req.tbsRequest.version.Value.IntValue;
return intValue + 1;
}
}
// Token: 0x170019B2 RID: 6578
// (get) Token: 0x0600A181 RID: 41345 RVA: 0x0021A11C File Offset: 0x0021831C
[Token(Token = "0x170019B2")]
public GeneralName RequestorName
{
[Token(Token = "0x600A181")]
[Address(RVA = "0xD026F0", Offset = "0xD016F0", VA = "0x180D026F0")]
get
{
return GeneralName.GetInstance(this.req.tbsRequest.requestorName);
}
}
// Token: 0x0600A182 RID: 41346 RVA: 0x0021A144 File Offset: 0x00218344
[Token(Token = "0x600A182")]
[Address(RVA = "0xD01FC0", Offset = "0xD00FC0", VA = "0x180D01FC0")]
public Req[] GetRequestList()
{
Asn1Sequence requestList = this.req.tbsRequest.requestList;
Asn1Encodable asn1Encodable;
Req[] array = new Req[asn1Encodable];
int num = 0;
if (num != array.Length)
{
Asn1SequenceParser parser = requestList.Parser;
Req req;
Request request;
req.req = request;
num++;
array[0] = req;
}
return array;
}
// Token: 0x170019B3 RID: 6579
// (get) Token: 0x0600A183 RID: 41347 RVA: 0x0021A19C File Offset: 0x0021839C
[Token(Token = "0x170019B3")]
public X509Extensions RequestExtensions
{
[Token(Token = "0x600A183")]
[Address(RVA = "0xD021F0", Offset = "0xD011F0", VA = "0x180D021F0")]
get
{
return X509Extensions.GetInstance(this.req.tbsRequest.requestExtensions);
}
}
// Token: 0x0600A184 RID: 41348 RVA: 0x0021A1C4 File Offset: 0x002183C4
[Token(Token = "0x600A184")]
[Address(RVA = "0xD021F0", Offset = "0xD011F0", VA = "0x180D021F0", Slot = "8")]
protected override X509Extensions GetX509Extensions()
{
return X509Extensions.GetInstance(this.req.tbsRequest.requestExtensions);
}
// Token: 0x170019B4 RID: 6580
// (get) Token: 0x0600A185 RID: 41349 RVA: 0x0021A1EC File Offset: 0x002183EC
[Token(Token = "0x170019B4")]
public string SignatureAlgOid
{
[Token(Token = "0x600A185")]
[Address(RVA = "0xD02720", Offset = "0xD01720", VA = "0x180D02720")]
get
{
Signature optionalSignature = this.req.optionalSignature;
if (optionalSignature != 0)
{
Asn1Object asn1Object = optionalSignature.signatureAlgorithm.ToAsn1Object();
}
throw new NullReferenceException();
}
}
// Token: 0x0600A186 RID: 41350 RVA: 0x0021A21C File Offset: 0x0021841C
[Token(Token = "0x600A186")]
[Address(RVA = "0xD02100", Offset = "0xD01100", VA = "0x180D02100")]
public byte[] GetSignature()
{
Signature optionalSignature = this.req.optionalSignature;
if (optionalSignature != 0)
{
return optionalSignature.GetSignatureOctets();
}
throw new NullReferenceException();
}
// Token: 0x0600A187 RID: 41351 RVA: 0x0021A248 File Offset: 0x00218448
[Token(Token = "0x600A187")]
[Address(RVA = "0xD019A0", Offset = "0xD009A0", VA = "0x180D019A0")]
private IList GetCertList()
{
IList list;
for (;;)
{
int num = 0;
list = Platform.CreateArrayList();
Asn1Sequence certs = this.req.optionalSignature.certs;
if (certs == 0)
{
break;
}
IEnumerator enumerator = certs.GetEnumerator();
if (enumerator != 0)
{
if (enumerator == 0)
{
}
if (enumerator == 0)
{
goto IL_66;
}
byte[] array;
if (new X509CertificateParser().ReadCertificate(array) != 0)
{
}
if (num == 0)
{
break;
}
}
}
return list;
IL_66:
throw new NullReferenceException();
}
// Token: 0x0600A188 RID: 41352 RVA: 0x0021A2C0 File Offset: 0x002184C0
[Token(Token = "0x600A188")]
[Address(RVA = "0xD01D20", Offset = "0xD00D20", VA = "0x180D01D20")]
public X509Certificate[] GetCerts()
{
while (this.req.optionalSignature > (ulong)0L)
{
IList certList = this.GetCertList();
X509Certificate[] array = new X509Certificate[certList];
int num = 0;
if (num < certList)
{
num += num;
num++;
}
if (num < array)
{
uint num2;
if (num < (int)num2)
{
num += num;
num++;
}
if (num != 0)
{
ulong num3;
num3 += num3;
num3 += num3;
if (num == 0 || num == 0)
{
continue;
}
}
num++;
array[0] = num;
}
return array;
}
throw new NullReferenceException();
}
// Token: 0x0600A189 RID: 41353 RVA: 0x0021A33C File Offset: 0x0021853C
[Token(Token = "0x600A189")]
[Address(RVA = "0xD01C10", Offset = "0xD00C10", VA = "0x180D01C10")]
public IX509Store GetCertificates(string type)
{
if (this.req.optionalSignature > (ulong)0L)
{
string text = "Certificate/" + type;
X509CollectionStoreParameters x509CollectionStoreParameters = new X509CollectionStoreParameters(this.GetCertList());
return X509StoreFactory.Create(text, x509CollectionStoreParameters);
}
throw new NullReferenceException();
}
// Token: 0x170019B5 RID: 6581
// (get) Token: 0x0600A18A RID: 41354 RVA: 0x0021A380 File Offset: 0x00218580
[Token(Token = "0x170019B5")]
public bool IsSigned
{
[Token(Token = "0x600A18A")]
[Address(RVA = "0xD026D0", Offset = "0xD016D0", VA = "0x180D026D0")]
get
{
OcspRequest ocspRequest = this.req;
throw new NullReferenceException();
}
}
// Token: 0x0600A18B RID: 41355 RVA: 0x0021A39C File Offset: 0x0021859C
[Token(Token = "0x600A18B")]
[Address(RVA = "0xD02260", Offset = "0xD01260", VA = "0x180D02260")]
public bool Verify(AsymmetricKeyParameter publicKey)
{
/*
An exception occurred when decompiling this method (0600A18B)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Boolean BestHTTP.SecureProtocol.Org.BouncyCastle.Ocsp.OcspReq::Verify(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.AsymmetricKeyParameter)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_B7:
stloc:OcspException(var_9_C1, newobj:OcspException(OcspException::.ctor, ldstr:string("attempt to Verify signature on unsigned object")))
}
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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
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: 0x0600A18C RID: 41356 RVA: 0x0021A46C File Offset: 0x0021866C
[Token(Token = "0x600A18C")]
[Address(RVA = "0x423720", Offset = "0x422720", VA = "0x180423720")]
public byte[] GetEncoded()
{
return this.req.GetEncoded();
}
// Token: 0x04006BC2 RID: 27586
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4006BC2")]
private OcspRequest req;
}
}