187 lines
9.0 KiB
C#
187 lines
9.0 KiB
C#
using System;
|
|
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.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Ocsp
|
|
{
|
|
// Token: 0x020019C3 RID: 6595
|
|
[Token(Token = "0x20019C3")]
|
|
public class CertificateID
|
|
{
|
|
// Token: 0x06009D9C RID: 40348 RVA: 0x00210CCC File Offset: 0x0020EECC
|
|
[Token(Token = "0x6009D9C")]
|
|
[Address(RVA = "0x28B5760", Offset = "0x28B4560", VA = "0x1828B5760")]
|
|
public CertificateID(CertID id)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009D9C)
|
|
|
|
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: 0x06009D9D RID: 40349 RVA: 0x00210CF8 File Offset: 0x0020EEF8
|
|
[Token(Token = "0x6009D9D")]
|
|
[Address(RVA = "0x28B57E0", Offset = "0x28B45E0", VA = "0x1828B57E0")]
|
|
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: 0x17001912 RID: 6418
|
|
// (get) Token: 0x06009D9E RID: 40350 RVA: 0x00210D3C File Offset: 0x0020EF3C
|
|
[Token(Token = "0x17001912")]
|
|
public string HashAlgOid
|
|
{
|
|
[Token(Token = "0x6009D9E")]
|
|
[Address(RVA = "0x28B58F0", Offset = "0x28B46F0", VA = "0x1828B58F0")]
|
|
get
|
|
{
|
|
Asn1Object asn1Object = this.id.hashAlgorithm.ToAsn1Object();
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009D9F RID: 40351 RVA: 0x00210D60 File Offset: 0x0020EF60
|
|
[Token(Token = "0x6009D9F")]
|
|
[Address(RVA = "0x28B56D0", Offset = "0x28B44D0", VA = "0x1828B56D0")]
|
|
public byte[] GetIssuerNameHash()
|
|
{
|
|
Stream octetStream = ((Asn1OctetStringParser)this.id.issuerNameHash).GetOctetStream();
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009DA0 RID: 40352 RVA: 0x00210D84 File Offset: 0x0020EF84
|
|
[Token(Token = "0x6009DA0")]
|
|
[Address(RVA = "0x28B5690", Offset = "0x28B4490", VA = "0x1828B5690")]
|
|
public byte[] GetIssuerKeyHash()
|
|
{
|
|
Stream octetStream = ((Asn1OctetStringParser)this.id.issuerKeyHash).GetOctetStream();
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x17001913 RID: 6419
|
|
// (get) Token: 0x06009DA1 RID: 40353 RVA: 0x00210DA8 File Offset: 0x0020EFA8
|
|
[Token(Token = "0x17001913")]
|
|
public BigInteger SerialNumber
|
|
{
|
|
[Token(Token = "0x6009DA1")]
|
|
[Address(RVA = "0x1B2C400", Offset = "0x1B2B200", VA = "0x181B2C400")]
|
|
get
|
|
{
|
|
return this.id.serialNumber.Value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009DA2 RID: 40354 RVA: 0x00210DCC File Offset: 0x0020EFCC
|
|
[Token(Token = "0x6009DA2")]
|
|
[Address(RVA = "0x28B5710", Offset = "0x28B4510", VA = "0x1828B5710")]
|
|
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: 0x06009DA3 RID: 40355 RVA: 0x00210E00 File Offset: 0x0020F000
|
|
[Token(Token = "0x6009DA3")]
|
|
[Address(RVA = "0x3F6E20", Offset = "0x3F5C20", VA = "0x1803F6E20")]
|
|
public CertID ToAsn1Object()
|
|
{
|
|
return this.id;
|
|
}
|
|
|
|
// Token: 0x06009DA4 RID: 40356 RVA: 0x00210E14 File Offset: 0x0020F014
|
|
[Token(Token = "0x6009DA4")]
|
|
[Address(RVA = "0x28B5540", Offset = "0x28B4340", VA = "0x1828B5540", 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: 0x06009DA5 RID: 40357 RVA: 0x00210E58 File Offset: 0x0020F058
|
|
[Token(Token = "0x6009DA5")]
|
|
[Address(RVA = "0x28B5650", Offset = "0x28B4450", VA = "0x1828B5650", Slot = "2")]
|
|
public override int GetHashCode()
|
|
{
|
|
return this.id.ToAsn1Object().Asn1GetHashCode();
|
|
}
|
|
|
|
// Token: 0x06009DA6 RID: 40358 RVA: 0x00210E7C File Offset: 0x0020F07C
|
|
[Token(Token = "0x6009DA6")]
|
|
[Address(RVA = "0x28B5450", Offset = "0x28B4250", VA = "0x1828B5450")]
|
|
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: 0x06009DA7 RID: 40359 RVA: 0x00210EC4 File Offset: 0x0020F0C4
|
|
[Token(Token = "0x6009DA7")]
|
|
[Address(RVA = "0x28B5240", Offset = "0x28B4040", VA = "0x1828B5240")]
|
|
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: 0x04006A06 RID: 27142
|
|
[Token(Token = "0x4006A06")]
|
|
public const string HashSha1 = "1.3.14.3.2.26";
|
|
|
|
// Token: 0x04006A07 RID: 27143
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006A07")]
|
|
private readonly CertID id;
|
|
}
|
|
}
|