312 lines
11 KiB
C#
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: 0x020019C6 RID: 6598
|
|
[Token(Token = "0x20019C6")]
|
|
public class OcspReq : X509ExtensionBase
|
|
{
|
|
// Token: 0x06009DAD RID: 40365 RVA: 0x00210FA0 File Offset: 0x0020F1A0
|
|
[Token(Token = "0x6009DAD")]
|
|
[Address(RVA = "0x462000", Offset = "0x460E00", VA = "0x180462000")]
|
|
public OcspReq(OcspRequest req)
|
|
{
|
|
this.req = req;
|
|
}
|
|
|
|
// Token: 0x06009DAE RID: 40366 RVA: 0x00210FBC File Offset: 0x0020F1BC
|
|
[Token(Token = "0x6009DAE")]
|
|
[Address(RVA = "0x28C6EF0", Offset = "0x28C5CF0", VA = "0x1828C6EF0")]
|
|
public OcspReq(byte[] req)
|
|
{
|
|
Asn1InputStream asn1InputStream = new Asn1InputStream(req);
|
|
}
|
|
|
|
// Token: 0x06009DAF RID: 40367 RVA: 0x00210FD0 File Offset: 0x0020F1D0
|
|
[Token(Token = "0x6009DAF")]
|
|
[Address(RVA = "0x28C6E80", Offset = "0x28C5C80", VA = "0x1828C6E80")]
|
|
public OcspReq(Stream inStr)
|
|
{
|
|
Asn1InputStream asn1InputStream = new Asn1InputStream(inStr);
|
|
}
|
|
|
|
// Token: 0x06009DB0 RID: 40368 RVA: 0x00210FE4 File Offset: 0x0020F1E4
|
|
[Token(Token = "0x6009DB0")]
|
|
[Address(RVA = "0x28C6F60", Offset = "0x28C5D60", VA = "0x1828C6F60")]
|
|
private OcspReq(Asn1InputStream aIn)
|
|
{
|
|
OcspRequest instance = OcspRequest.GetInstance(aIn.ReadObject());
|
|
this.req = instance;
|
|
}
|
|
|
|
// Token: 0x06009DB1 RID: 40369 RVA: 0x00211020 File Offset: 0x0020F220
|
|
[Token(Token = "0x6009DB1")]
|
|
[Address(RVA = "0x28C6B10", Offset = "0x28C5910", VA = "0x1828C6B10")]
|
|
public byte[] GetTbsRequest()
|
|
{
|
|
return this.req.tbsRequest.GetEncoded();
|
|
}
|
|
|
|
// Token: 0x17001914 RID: 6420
|
|
// (get) Token: 0x06009DB2 RID: 40370 RVA: 0x0021104C File Offset: 0x0020F24C
|
|
[Token(Token = "0x17001914")]
|
|
public int Version
|
|
{
|
|
[Token(Token = "0x6009DB2")]
|
|
[Address(RVA = "0x1636AA0", Offset = "0x16358A0", VA = "0x181636AA0")]
|
|
get
|
|
{
|
|
int intValue = this.req.tbsRequest.version.Value.IntValue;
|
|
return intValue + 1;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001915 RID: 6421
|
|
// (get) Token: 0x06009DB3 RID: 40371 RVA: 0x00211080 File Offset: 0x0020F280
|
|
[Token(Token = "0x17001915")]
|
|
public GeneralName RequestorName
|
|
{
|
|
[Token(Token = "0x6009DB3")]
|
|
[Address(RVA = "0x28C70C0", Offset = "0x28C5EC0", VA = "0x1828C70C0")]
|
|
get
|
|
{
|
|
return GeneralName.GetInstance(this.req.tbsRequest.requestorName);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009DB4 RID: 40372 RVA: 0x002110A8 File Offset: 0x0020F2A8
|
|
[Token(Token = "0x6009DB4")]
|
|
[Address(RVA = "0x28C6990", Offset = "0x28C5790", VA = "0x1828C6990")]
|
|
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: 0x17001916 RID: 6422
|
|
// (get) Token: 0x06009DB5 RID: 40373 RVA: 0x00211100 File Offset: 0x0020F300
|
|
[Token(Token = "0x17001916")]
|
|
public X509Extensions RequestExtensions
|
|
{
|
|
[Token(Token = "0x6009DB5")]
|
|
[Address(RVA = "0x28C6BC0", Offset = "0x28C59C0", VA = "0x1828C6BC0")]
|
|
get
|
|
{
|
|
return X509Extensions.GetInstance(this.req.tbsRequest.requestExtensions);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009DB6 RID: 40374 RVA: 0x00211128 File Offset: 0x0020F328
|
|
[Token(Token = "0x6009DB6")]
|
|
[Address(RVA = "0x28C6BC0", Offset = "0x28C59C0", VA = "0x1828C6BC0", Slot = "8")]
|
|
protected override X509Extensions GetX509Extensions()
|
|
{
|
|
return X509Extensions.GetInstance(this.req.tbsRequest.requestExtensions);
|
|
}
|
|
|
|
// Token: 0x17001917 RID: 6423
|
|
// (get) Token: 0x06009DB7 RID: 40375 RVA: 0x00211150 File Offset: 0x0020F350
|
|
[Token(Token = "0x17001917")]
|
|
public string SignatureAlgOid
|
|
{
|
|
[Token(Token = "0x6009DB7")]
|
|
[Address(RVA = "0x28C70F0", Offset = "0x28C5EF0", VA = "0x1828C70F0")]
|
|
get
|
|
{
|
|
Signature optionalSignature = this.req.optionalSignature;
|
|
if (optionalSignature != 0)
|
|
{
|
|
Asn1Object asn1Object = optionalSignature.signatureAlgorithm.ToAsn1Object();
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009DB8 RID: 40376 RVA: 0x00211180 File Offset: 0x0020F380
|
|
[Token(Token = "0x6009DB8")]
|
|
[Address(RVA = "0x28C6AD0", Offset = "0x28C58D0", VA = "0x1828C6AD0")]
|
|
public byte[] GetSignature()
|
|
{
|
|
Signature optionalSignature = this.req.optionalSignature;
|
|
if (optionalSignature != 0)
|
|
{
|
|
return optionalSignature.GetSignatureOctets();
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009DB9 RID: 40377 RVA: 0x002111AC File Offset: 0x0020F3AC
|
|
[Token(Token = "0x6009DB9")]
|
|
[Address(RVA = "0x28C6370", Offset = "0x28C5170", VA = "0x1828C6370")]
|
|
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: 0x06009DBA RID: 40378 RVA: 0x00211224 File Offset: 0x0020F424
|
|
[Token(Token = "0x6009DBA")]
|
|
[Address(RVA = "0x28C66F0", Offset = "0x28C54F0", VA = "0x1828C66F0")]
|
|
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: 0x06009DBB RID: 40379 RVA: 0x002112A0 File Offset: 0x0020F4A0
|
|
[Token(Token = "0x6009DBB")]
|
|
[Address(RVA = "0x28C65E0", Offset = "0x28C53E0", VA = "0x1828C65E0")]
|
|
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: 0x17001918 RID: 6424
|
|
// (get) Token: 0x06009DBC RID: 40380 RVA: 0x002112E4 File Offset: 0x0020F4E4
|
|
[Token(Token = "0x17001918")]
|
|
public bool IsSigned
|
|
{
|
|
[Token(Token = "0x6009DBC")]
|
|
[Address(RVA = "0x28C70A0", Offset = "0x28C5EA0", VA = "0x1828C70A0")]
|
|
get
|
|
{
|
|
OcspRequest ocspRequest = this.req;
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009DBD RID: 40381 RVA: 0x00211300 File Offset: 0x0020F500
|
|
[Token(Token = "0x6009DBD")]
|
|
[Address(RVA = "0x28C6C30", Offset = "0x28C5A30", VA = "0x1828C6C30")]
|
|
public bool Verify(AsymmetricKeyParameter publicKey)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009DBD)
|
|
|
|
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: 0x06009DBE RID: 40382 RVA: 0x002113D0 File Offset: 0x0020F5D0
|
|
[Token(Token = "0x6009DBE")]
|
|
[Address(RVA = "0x16362F0", Offset = "0x16350F0", VA = "0x1816362F0")]
|
|
public byte[] GetEncoded()
|
|
{
|
|
return this.req.GetEncoded();
|
|
}
|
|
|
|
// Token: 0x04006A09 RID: 27145
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006A09")]
|
|
private OcspRequest req;
|
|
}
|
|
}
|