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: 0x02001AA3 RID: 6819
|
|
[Token(Token = "0x2001AA3")]
|
|
public class CertificateID
|
|
{
|
|
// Token: 0x0600A16A RID: 41322 RVA: 0x00219D68 File Offset: 0x00217F68
|
|
[Token(Token = "0x600A16A")]
|
|
[Address(RVA = "0xCF0D90", Offset = "0xCEFD90", VA = "0x180CF0D90")]
|
|
public CertificateID(CertID id)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600A16A)
|
|
|
|
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: 0x0600A16B RID: 41323 RVA: 0x00219D94 File Offset: 0x00217F94
|
|
[Token(Token = "0x600A16B")]
|
|
[Address(RVA = "0xCF0E10", Offset = "0xCEFE10", VA = "0x180CF0E10")]
|
|
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: 0x170019AF RID: 6575
|
|
// (get) Token: 0x0600A16C RID: 41324 RVA: 0x00219DD8 File Offset: 0x00217FD8
|
|
[Token(Token = "0x170019AF")]
|
|
public string HashAlgOid
|
|
{
|
|
[Token(Token = "0x600A16C")]
|
|
[Address(RVA = "0xCF0F20", Offset = "0xCEFF20", VA = "0x180CF0F20")]
|
|
get
|
|
{
|
|
Asn1Object asn1Object = this.id.hashAlgorithm.ToAsn1Object();
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600A16D RID: 41325 RVA: 0x00219DFC File Offset: 0x00217FFC
|
|
[Token(Token = "0x600A16D")]
|
|
[Address(RVA = "0xCF0D00", Offset = "0xCEFD00", VA = "0x180CF0D00")]
|
|
public byte[] GetIssuerNameHash()
|
|
{
|
|
Stream octetStream = ((Asn1OctetStringParser)this.id.issuerNameHash).GetOctetStream();
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600A16E RID: 41326 RVA: 0x00219E20 File Offset: 0x00218020
|
|
[Token(Token = "0x600A16E")]
|
|
[Address(RVA = "0xCF0CC0", Offset = "0xCEFCC0", VA = "0x180CF0CC0")]
|
|
public byte[] GetIssuerKeyHash()
|
|
{
|
|
Stream octetStream = ((Asn1OctetStringParser)this.id.issuerKeyHash).GetOctetStream();
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x170019B0 RID: 6576
|
|
// (get) Token: 0x0600A16F RID: 41327 RVA: 0x00219E44 File Offset: 0x00218044
|
|
[Token(Token = "0x170019B0")]
|
|
public BigInteger SerialNumber
|
|
{
|
|
[Token(Token = "0x600A16F")]
|
|
[Address(RVA = "0x5F1F00", Offset = "0x5F0F00", VA = "0x1805F1F00")]
|
|
get
|
|
{
|
|
return this.id.serialNumber.Value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600A170 RID: 41328 RVA: 0x00219E68 File Offset: 0x00218068
|
|
[Token(Token = "0x600A170")]
|
|
[Address(RVA = "0xCF0D40", Offset = "0xCEFD40", VA = "0x180CF0D40")]
|
|
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: 0x0600A171 RID: 41329 RVA: 0x00219E9C File Offset: 0x0021809C
|
|
[Token(Token = "0x600A171")]
|
|
[Address(RVA = "0x411530", Offset = "0x410530", VA = "0x180411530")]
|
|
public CertID ToAsn1Object()
|
|
{
|
|
return this.id;
|
|
}
|
|
|
|
// Token: 0x0600A172 RID: 41330 RVA: 0x00219EB0 File Offset: 0x002180B0
|
|
[Token(Token = "0x600A172")]
|
|
[Address(RVA = "0xCF0B70", Offset = "0xCEFB70", VA = "0x180CF0B70", 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: 0x0600A173 RID: 41331 RVA: 0x00219EF4 File Offset: 0x002180F4
|
|
[Token(Token = "0x600A173")]
|
|
[Address(RVA = "0xCF0C80", Offset = "0xCEFC80", VA = "0x180CF0C80", Slot = "2")]
|
|
public override int GetHashCode()
|
|
{
|
|
return this.id.ToAsn1Object().Asn1GetHashCode();
|
|
}
|
|
|
|
// Token: 0x0600A174 RID: 41332 RVA: 0x00219F18 File Offset: 0x00218118
|
|
[Token(Token = "0x600A174")]
|
|
[Address(RVA = "0xCF0A80", Offset = "0xCEFA80", VA = "0x180CF0A80")]
|
|
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: 0x0600A175 RID: 41333 RVA: 0x00219F60 File Offset: 0x00218160
|
|
[Token(Token = "0x600A175")]
|
|
[Address(RVA = "0xCF0870", Offset = "0xCEF870", VA = "0x180CF0870")]
|
|
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: 0x04006BBF RID: 27583
|
|
[Token(Token = "0x4006BBF")]
|
|
public const string HashSha1 = "1.3.14.3.2.26";
|
|
|
|
// Token: 0x04006BC0 RID: 27584
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006BC0")]
|
|
private readonly CertID id;
|
|
}
|
|
}
|