189 lines
9.1 KiB
C#
189 lines
9.1 KiB
C#
using System;
|
|
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.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Ocsp
|
|
{
|
|
// Token: 0x020013E6 RID: 5094
|
|
[Token(Token = "0x20013E6")]
|
|
[StructLayout(3)]
|
|
public class CertificateID
|
|
{
|
|
// Token: 0x060081C2 RID: 33218 RVA: 0x001B973C File Offset: 0x001B793C
|
|
[Token(Token = "0x60081C2")]
|
|
[Address(RVA = "0xC11C70", Offset = "0xC10670", VA = "0x180C11C70")]
|
|
public CertificateID(CertID id)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (060081C2)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Ocsp.CertificateID::.ctor(BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ocsp.CertID)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_12:
|
|
stloc:ArgumentNullException(var_0_1C, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("id")))
|
|
}
|
|
|
|
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: 0x060081C3 RID: 33219 RVA: 0x001B9768 File Offset: 0x001B7968
|
|
[Token(Token = "0x60081C3")]
|
|
[Address(RVA = "0xC11CF0", Offset = "0xC106F0", VA = "0x180C11CF0")]
|
|
public CertificateID(string hashAlgorithm, X509Certificate issuerCert, BigInteger serialNumber)
|
|
{
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(hashAlgorithm);
|
|
DerNull instance = DerNull.Instance;
|
|
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(derObjectIdentifier, instance);
|
|
DerInteger derInteger = new DerInteger(serialNumber);
|
|
CertID certID = CertificateID.CreateCertID(algorithmIdentifier, issuerCert, derInteger);
|
|
this.id = certID;
|
|
}
|
|
|
|
// Token: 0x17001511 RID: 5393
|
|
// (get) Token: 0x060081C4 RID: 33220 RVA: 0x001B97AC File Offset: 0x001B79AC
|
|
[Token(Token = "0x17001511")]
|
|
public string HashAlgOid
|
|
{
|
|
[Token(Token = "0x60081C4")]
|
|
[Address(RVA = "0xC11E00", Offset = "0xC10800", VA = "0x180C11E00")]
|
|
get
|
|
{
|
|
Asn1Object asn1Object = this.id.hashAlgorithm.ToAsn1Object();
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x060081C5 RID: 33221 RVA: 0x001B97D0 File Offset: 0x001B79D0
|
|
[Token(Token = "0x60081C5")]
|
|
[Address(RVA = "0xC11BE0", Offset = "0xC105E0", VA = "0x180C11BE0")]
|
|
public byte[] GetIssuerNameHash()
|
|
{
|
|
Stream octetStream = ((Asn1OctetStringParser)this.id.issuerNameHash).GetOctetStream();
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060081C6 RID: 33222 RVA: 0x001B97F4 File Offset: 0x001B79F4
|
|
[Token(Token = "0x60081C6")]
|
|
[Address(RVA = "0xC11BA0", Offset = "0xC105A0", VA = "0x180C11BA0")]
|
|
public byte[] GetIssuerKeyHash()
|
|
{
|
|
Stream octetStream = ((Asn1OctetStringParser)this.id.issuerKeyHash).GetOctetStream();
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x17001512 RID: 5394
|
|
// (get) Token: 0x060081C7 RID: 33223 RVA: 0x001B9818 File Offset: 0x001B7A18
|
|
[Token(Token = "0x17001512")]
|
|
public BigInteger SerialNumber
|
|
{
|
|
[Token(Token = "0x60081C7")]
|
|
[Address(RVA = "0xC11E40", Offset = "0xC10840", VA = "0x180C11E40")]
|
|
get
|
|
{
|
|
return this.id.serialNumber.Value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060081C8 RID: 33224 RVA: 0x001B983C File Offset: 0x001B7A3C
|
|
[Token(Token = "0x60081C8")]
|
|
[Address(RVA = "0xC11C20", Offset = "0xC10620", VA = "0x180C11C20")]
|
|
public bool MatchesIssuer(X509Certificate issuerCert)
|
|
{
|
|
CertID certID = this.id;
|
|
DerInteger serialNumber = certID.serialNumber;
|
|
Asn1Object asn1Object = CertificateID.CreateCertID(certID.hashAlgorithm, issuerCert, serialNumber).ToAsn1Object();
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x060081C9 RID: 33225 RVA: 0x001B9870 File Offset: 0x001B7A70
|
|
[Token(Token = "0x60081C9")]
|
|
[Address(RVA = "0x3C39A0", Offset = "0x3C23A0", VA = "0x1803C39A0")]
|
|
public CertID ToAsn1Object()
|
|
{
|
|
return this.id;
|
|
}
|
|
|
|
// Token: 0x060081CA RID: 33226 RVA: 0x001B9884 File Offset: 0x001B7A84
|
|
[Token(Token = "0x60081CA")]
|
|
[Address(RVA = "0xC11A50", Offset = "0xC10450", VA = "0x180C11A50", Slot = "0")]
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj != this)
|
|
{
|
|
if (obj != 0 && obj != 0)
|
|
{
|
|
CertID certID = this.id;
|
|
Asn1Object asn1Object = certID.ToAsn1Object();
|
|
Asn1Object asn1Object2 = certID.ToAsn1Object();
|
|
return asn1Object.Asn1Equals(asn1Object2);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x060081CB RID: 33227 RVA: 0x001B98C8 File Offset: 0x001B7AC8
|
|
[Token(Token = "0x60081CB")]
|
|
[Address(RVA = "0xC11B60", Offset = "0xC10560", VA = "0x180C11B60", Slot = "2")]
|
|
public override int GetHashCode()
|
|
{
|
|
return this.id.ToAsn1Object().Asn1GetHashCode();
|
|
}
|
|
|
|
// Token: 0x060081CC RID: 33228 RVA: 0x001B98EC File Offset: 0x001B7AEC
|
|
[Token(Token = "0x60081CC")]
|
|
[Address(RVA = "0xC11960", Offset = "0xC10360", VA = "0x180C11960")]
|
|
public static CertificateID DeriveCertificateID(CertificateID original, BigInteger newSerialNumber)
|
|
{
|
|
CertID certID = original.id;
|
|
Asn1OctetString issuerNameHash = certID.issuerNameHash;
|
|
AlgorithmIdentifier hashAlgorithm = certID.hashAlgorithm;
|
|
Asn1OctetString issuerKeyHash = certID.issuerKeyHash;
|
|
DerInteger derInteger = new DerInteger(newSerialNumber);
|
|
return new CertificateID(new CertID(hashAlgorithm, issuerNameHash, issuerKeyHash, derInteger));
|
|
}
|
|
|
|
// Token: 0x060081CD RID: 33229 RVA: 0x001B9934 File Offset: 0x001B7B34
|
|
[Token(Token = "0x60081CD")]
|
|
[Address(RVA = "0xC11750", Offset = "0xC10150", VA = "0x180C11750")]
|
|
private static CertID CreateCertID(AlgorithmIdentifier hashAlg, X509Certificate issuerCert, DerInteger serialNumber)
|
|
{
|
|
Asn1Object asn1Object = hashAlg.ToAsn1Object();
|
|
byte[] encoded = PrincipalUtilities.GetSubjectX509Principal(issuerCert).GetEncoded();
|
|
SubjectPublicKeyInfo subjectPublicKeyInfo;
|
|
byte[] octets = subjectPublicKeyInfo.keyData.GetOctets();
|
|
byte[] array;
|
|
DerOctetString derOctetString = new DerOctetString(array);
|
|
byte[] array2;
|
|
DerOctetString derOctetString2 = new DerOctetString(array2);
|
|
return new CertID(hashAlg, derOctetString, derOctetString2, serialNumber);
|
|
}
|
|
|
|
// Token: 0x04005BC3 RID: 23491
|
|
[Token(Token = "0x4005BC3")]
|
|
public const string HashSha1 = "1.3.14.3.2.26";
|
|
|
|
// Token: 0x04005BC4 RID: 23492
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4005BC4")]
|
|
private readonly CertID id;
|
|
}
|
|
}
|