317 lines
11 KiB
C#
317 lines
11 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
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: 0x020013E9 RID: 5097
|
|
[Token(Token = "0x20013E9")]
|
|
[StructLayout(3)]
|
|
public class OcspReq : X509ExtensionBase
|
|
{
|
|
// Token: 0x060081D3 RID: 33235 RVA: 0x001B9A10 File Offset: 0x001B7C10
|
|
[Token(Token = "0x60081D3")]
|
|
[Address(RVA = "0x579A20", Offset = "0x578420", VA = "0x180579A20")]
|
|
public OcspReq(OcspRequest req)
|
|
{
|
|
this.req = req;
|
|
}
|
|
|
|
// Token: 0x060081D4 RID: 33236 RVA: 0x001B9A2C File Offset: 0x001B7C2C
|
|
[Token(Token = "0x60081D4")]
|
|
[Address(RVA = "0xC222A0", Offset = "0xC20CA0", VA = "0x180C222A0")]
|
|
public OcspReq(byte[] req)
|
|
{
|
|
Asn1InputStream asn1InputStream = new Asn1InputStream(req);
|
|
}
|
|
|
|
// Token: 0x060081D5 RID: 33237 RVA: 0x001B9A40 File Offset: 0x001B7C40
|
|
[Token(Token = "0x60081D5")]
|
|
[Address(RVA = "0xC22230", Offset = "0xC20C30", VA = "0x180C22230")]
|
|
public OcspReq(Stream inStr)
|
|
{
|
|
Asn1InputStream asn1InputStream = new Asn1InputStream(inStr);
|
|
}
|
|
|
|
// Token: 0x060081D6 RID: 33238 RVA: 0x001B9A54 File Offset: 0x001B7C54
|
|
[Token(Token = "0x60081D6")]
|
|
[Address(RVA = "0xC22310", Offset = "0xC20D10", VA = "0x180C22310")]
|
|
private OcspReq(Asn1InputStream aIn)
|
|
{
|
|
OcspRequest instance = OcspRequest.GetInstance(aIn.ReadObject());
|
|
this.req = instance;
|
|
}
|
|
|
|
// Token: 0x060081D7 RID: 33239 RVA: 0x001B9A90 File Offset: 0x001B7C90
|
|
[Token(Token = "0x60081D7")]
|
|
[Address(RVA = "0xC21EC0", Offset = "0xC208C0", VA = "0x180C21EC0")]
|
|
public byte[] GetTbsRequest()
|
|
{
|
|
return this.req.tbsRequest.GetEncoded();
|
|
}
|
|
|
|
// Token: 0x17001513 RID: 5395
|
|
// (get) Token: 0x060081D8 RID: 33240 RVA: 0x001B9ABC File Offset: 0x001B7CBC
|
|
[Token(Token = "0x17001513")]
|
|
public int Version
|
|
{
|
|
[Token(Token = "0x60081D8")]
|
|
[Address(RVA = "0x53C660", Offset = "0x53B060", VA = "0x18053C660")]
|
|
get
|
|
{
|
|
int intValue = this.req.tbsRequest.version.Value.IntValue;
|
|
return intValue + 1;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001514 RID: 5396
|
|
// (get) Token: 0x060081D9 RID: 33241 RVA: 0x001B9AF0 File Offset: 0x001B7CF0
|
|
[Token(Token = "0x17001514")]
|
|
public GeneralName RequestorName
|
|
{
|
|
[Token(Token = "0x60081D9")]
|
|
[Address(RVA = "0xC22470", Offset = "0xC20E70", VA = "0x180C22470")]
|
|
get
|
|
{
|
|
return GeneralName.GetInstance(this.req.tbsRequest.requestorName);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060081DA RID: 33242 RVA: 0x001B9B18 File Offset: 0x001B7D18
|
|
[Token(Token = "0x60081DA")]
|
|
[Address(RVA = "0xC21D40", Offset = "0xC20740", VA = "0x180C21D40")]
|
|
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: 0x17001515 RID: 5397
|
|
// (get) Token: 0x060081DB RID: 33243 RVA: 0x001B9B70 File Offset: 0x001B7D70
|
|
[Token(Token = "0x17001515")]
|
|
public X509Extensions RequestExtensions
|
|
{
|
|
[Token(Token = "0x60081DB")]
|
|
[Address(RVA = "0xC21F70", Offset = "0xC20970", VA = "0x180C21F70")]
|
|
get
|
|
{
|
|
return X509Extensions.GetInstance(this.req.tbsRequest.requestExtensions);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060081DC RID: 33244 RVA: 0x001B9B98 File Offset: 0x001B7D98
|
|
[Token(Token = "0x60081DC")]
|
|
[Address(RVA = "0xC21F70", Offset = "0xC20970", VA = "0x180C21F70", Slot = "8")]
|
|
protected override X509Extensions GetX509Extensions()
|
|
{
|
|
return X509Extensions.GetInstance(this.req.tbsRequest.requestExtensions);
|
|
}
|
|
|
|
// Token: 0x17001516 RID: 5398
|
|
// (get) Token: 0x060081DD RID: 33245 RVA: 0x001B9BC0 File Offset: 0x001B7DC0
|
|
[Token(Token = "0x17001516")]
|
|
public string SignatureAlgOid
|
|
{
|
|
[Token(Token = "0x60081DD")]
|
|
[Address(RVA = "0xC224A0", Offset = "0xC20EA0", VA = "0x180C224A0")]
|
|
get
|
|
{
|
|
Signature optionalSignature = this.req.optionalSignature;
|
|
if (optionalSignature != 0)
|
|
{
|
|
Asn1Object asn1Object = optionalSignature.signatureAlgorithm.ToAsn1Object();
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x060081DE RID: 33246 RVA: 0x001B9BF0 File Offset: 0x001B7DF0
|
|
[Token(Token = "0x60081DE")]
|
|
[Address(RVA = "0xC21E80", Offset = "0xC20880", VA = "0x180C21E80")]
|
|
public byte[] GetSignature()
|
|
{
|
|
Signature optionalSignature = this.req.optionalSignature;
|
|
if (optionalSignature != 0)
|
|
{
|
|
return optionalSignature.GetSignatureOctets();
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060081DF RID: 33247 RVA: 0x001B9C1C File Offset: 0x001B7E1C
|
|
[Token(Token = "0x60081DF")]
|
|
[Address(RVA = "0xC216F0", Offset = "0xC200F0", VA = "0x180C216F0")]
|
|
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_6A;
|
|
}
|
|
byte[] array;
|
|
if (new X509CertificateParser().ReadCertificate(array) != 0)
|
|
{
|
|
}
|
|
if (num != -1)
|
|
{
|
|
}
|
|
if (num == 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return list;
|
|
IL_6A:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060081E0 RID: 33248 RVA: 0x001B9C98 File Offset: 0x001B7E98
|
|
[Token(Token = "0x60081E0")]
|
|
[Address(RVA = "0xC21AA0", Offset = "0xC204A0", VA = "0x180C21AA0")]
|
|
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: 0x060081E1 RID: 33249 RVA: 0x001B9D14 File Offset: 0x001B7F14
|
|
[Token(Token = "0x60081E1")]
|
|
[Address(RVA = "0xC21990", Offset = "0xC20390", VA = "0x180C21990")]
|
|
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: 0x17001517 RID: 5399
|
|
// (get) Token: 0x060081E2 RID: 33250 RVA: 0x001B9D58 File Offset: 0x001B7F58
|
|
[Token(Token = "0x17001517")]
|
|
public bool IsSigned
|
|
{
|
|
[Token(Token = "0x60081E2")]
|
|
[Address(RVA = "0xC22450", Offset = "0xC20E50", VA = "0x180C22450")]
|
|
get
|
|
{
|
|
OcspRequest ocspRequest = this.req;
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x060081E3 RID: 33251 RVA: 0x001B9D74 File Offset: 0x001B7F74
|
|
[Token(Token = "0x60081E3")]
|
|
[Address(RVA = "0xC21FE0", Offset = "0xC209E0", VA = "0x180C21FE0")]
|
|
public bool Verify(AsymmetricKeyParameter publicKey)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (060081E3)
|
|
|
|
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: 0x060081E4 RID: 33252 RVA: 0x001B9E44 File Offset: 0x001B8044
|
|
[Token(Token = "0x60081E4")]
|
|
[Address(RVA = "0x53BEA0", Offset = "0x53A8A0", VA = "0x18053BEA0")]
|
|
public byte[] GetEncoded()
|
|
{
|
|
return this.req.GetEncoded();
|
|
}
|
|
|
|
// Token: 0x04005BC6 RID: 23494
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4005BC6")]
|
|
private OcspRequest req;
|
|
}
|
|
}
|