374 lines
11 KiB
C#
374 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.Pkcs;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security.Certificates;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Pkix
|
|
{
|
|
// Token: 0x0200139A RID: 5018
|
|
[Token(Token = "0x200139A")]
|
|
[StructLayout(3)]
|
|
public class PkixCertPath
|
|
{
|
|
// Token: 0x06007F2E RID: 32558 RVA: 0x001AA938 File Offset: 0x001A8B38
|
|
[Token(Token = "0x6007F2E")]
|
|
[Address(RVA = "0x4F2B20", Offset = "0x4F1520", VA = "0x1804F2B20")]
|
|
private static IList SortCerts(IList certs)
|
|
{
|
|
IList list2;
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
if ((uint)1 == (uint)num)
|
|
{
|
|
goto IL_7B;
|
|
}
|
|
if (num != 0)
|
|
{
|
|
bool flag;
|
|
if (flag)
|
|
{
|
|
}
|
|
IList list = Platform.CreateArrayList(flag ? 1 : 0);
|
|
list2 = Platform.CreateArrayList(certs);
|
|
int num2 = 0;
|
|
if (num2 >= list2)
|
|
{
|
|
break;
|
|
}
|
|
if (list2 != 0)
|
|
{
|
|
bool flag2;
|
|
while (!flag2)
|
|
{
|
|
}
|
|
}
|
|
if (-1 != 0)
|
|
{
|
|
}
|
|
if (18446744073709551615UL != (ulong)(-1L))
|
|
{
|
|
if ((ulong)1L == 0UL)
|
|
{
|
|
}
|
|
num2++;
|
|
}
|
|
if (list2 == 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
int num3 = 0;
|
|
if (0 != -1)
|
|
{
|
|
int num4 = 0;
|
|
bool flag3;
|
|
if (num4 < -1 && !flag3)
|
|
{
|
|
num4++;
|
|
}
|
|
num3++;
|
|
}
|
|
return list2;
|
|
IL_7B:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06007F2F RID: 32559 RVA: 0x001AA9C8 File Offset: 0x001A8BC8
|
|
[Token(Token = "0x6007F2F")]
|
|
[Address(RVA = "0x4F3450", Offset = "0x4F1E50", VA = "0x1804F3450")]
|
|
public PkixCertPath(ICollection certificates)
|
|
{
|
|
IList list = PkixCertPath.SortCerts(Platform.CreateArrayList(certificates));
|
|
this.certificates = list;
|
|
}
|
|
|
|
// Token: 0x06007F30 RID: 32560 RVA: 0x001AA9F0 File Offset: 0x001A8BF0
|
|
[Token(Token = "0x6007F30")]
|
|
[Address(RVA = "0x4F34F0", Offset = "0x4F1EF0", VA = "0x1804F34F0")]
|
|
public PkixCertPath(Stream inStream)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06007F31 RID: 32561 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6007F31")]
|
|
[Address(RVA = "0x4F3540", Offset = "0x4F1F40", VA = "0x1804F3540")]
|
|
public PkixCertPath(Stream inStream, string encoding)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x170014D4 RID: 5332
|
|
// (get) Token: 0x06007F32 RID: 32562 RVA: 0x001AAA00 File Offset: 0x001A8C00
|
|
[Token(Token = "0x170014D4")]
|
|
public virtual IEnumerable Encodings
|
|
{
|
|
[Token(Token = "0x6007F32")]
|
|
[Address(RVA = "0x4F3C10", Offset = "0x4F2610", VA = "0x1804F3C10", Slot = "4")]
|
|
get
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06007F32)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Collections.IEnumerable BestHTTP.SecureProtocol.Org.BouncyCastle.Pkix.PkixCertPath::get_Encodings()
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
Block_0:
|
|
stloc:EnumerableProxy(var_0_0A, newobj:EnumerableProxy(EnumerableProxy::.ctor, ldsfld:IList[exp:IEnumerable](PkixCertPath::certPathEncodings)))
|
|
}
|
|
|
|
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.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: 0x06007F33 RID: 32563 RVA: 0x001AAA18 File Offset: 0x001A8C18
|
|
[Token(Token = "0x6007F33")]
|
|
[Address(RVA = "0x4F1F50", Offset = "0x4F0950", VA = "0x1804F1F50", Slot = "0")]
|
|
public override bool Equals(object obj)
|
|
{
|
|
while (this != obj)
|
|
{
|
|
byte[] array;
|
|
if (obj != 0 && obj != 0 && array == null)
|
|
{
|
|
if (array != 0)
|
|
{
|
|
if (object.Equals(array, array))
|
|
{
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x06007F34 RID: 32564 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6007F34")]
|
|
[Address(RVA = "0x4F2AE0", Offset = "0x4F14E0", VA = "0x1804F2AE0", Slot = "2")]
|
|
public override int GetHashCode()
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06007F35 RID: 32565 RVA: 0x001AAA50 File Offset: 0x001A8C50
|
|
[Token(Token = "0x6007F35")]
|
|
[Address(RVA = "0x4F2110", Offset = "0x4F0B10", VA = "0x1804F2110", Slot = "5")]
|
|
public virtual byte[] GetEncoded()
|
|
{
|
|
byte[] array;
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
string text = this.ToString();
|
|
if (text != 0)
|
|
{
|
|
while (text == 0)
|
|
{
|
|
}
|
|
while (text == 0)
|
|
{
|
|
}
|
|
if (text == 0)
|
|
{
|
|
goto IL_45;
|
|
}
|
|
}
|
|
if (array != 0)
|
|
{
|
|
}
|
|
if (num != -1)
|
|
{
|
|
if (typeof(IDisposable).TypeHandle == (ulong)73L)
|
|
{
|
|
break;
|
|
}
|
|
if (typeof(IDisposable).TypeHandle == (ulong)71L)
|
|
{
|
|
goto IL_3D;
|
|
}
|
|
}
|
|
if (num == 0)
|
|
{
|
|
goto IL_3D;
|
|
}
|
|
}
|
|
return array;
|
|
IL_3D:
|
|
throw new NullReferenceException();
|
|
IL_45:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06007F36 RID: 32566 RVA: 0x001AAAA8 File Offset: 0x001A8CA8
|
|
[Token(Token = "0x6007F36")]
|
|
[Address(RVA = "0x4F22E0", Offset = "0x4F0CE0", VA = "0x1804F22E0", Slot = "6")]
|
|
public virtual byte[] GetEncoded(string encoding)
|
|
{
|
|
int num3;
|
|
int num4;
|
|
Asn1EncodableVector asn1EncodableVector;
|
|
Asn1Encodable[] array;
|
|
int num5;
|
|
Asn1Encodable[] array2;
|
|
for (;;)
|
|
{
|
|
if (!Platform.EqualsIgnoreCase(encoding, "PkiPath"))
|
|
{
|
|
if (!Platform.EqualsIgnoreCase(encoding, "PKCS7"))
|
|
{
|
|
if (!Platform.EqualsIgnoreCase(encoding, "PEM"))
|
|
{
|
|
goto IL_1AA;
|
|
}
|
|
PemWriter pemWriter = new PemWriter(new StreamWriter(new MemoryStream()));
|
|
int num = 0;
|
|
IList list = this.certificates;
|
|
if (num != pemWriter)
|
|
{
|
|
IList list2 = this.certificates;
|
|
pemWriter.WriteObject(pemWriter);
|
|
num++;
|
|
}
|
|
TextWriter writer = pemWriter.writer;
|
|
}
|
|
int num2;
|
|
ContentInfo contentInfo = new ContentInfo(PkcsObjectIdentifiers.Data, num2);
|
|
num3 = 0;
|
|
num2 = 0;
|
|
num4 = 0;
|
|
IList list3 = this.certificates;
|
|
if (num4 == asn1EncodableVector)
|
|
{
|
|
goto IL_E4;
|
|
}
|
|
array = new Asn1Encodable[1];
|
|
IList list4 = this.certificates;
|
|
if (num4 < list3)
|
|
{
|
|
num4 += num4;
|
|
num4++;
|
|
}
|
|
if (array == 0)
|
|
{
|
|
num4 += num4;
|
|
}
|
|
if (array != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
IList list5 = this.certificates;
|
|
num5 = 0;
|
|
array2 = new Asn1Encodable[1];
|
|
IList list6 = this.certificates;
|
|
if (num5 < list5)
|
|
{
|
|
num5 += num5;
|
|
num5++;
|
|
}
|
|
if (num5 == 0)
|
|
{
|
|
num5 += num5;
|
|
num5 += 19;
|
|
}
|
|
if (num5 != 0)
|
|
{
|
|
goto Block_10;
|
|
}
|
|
}
|
|
}
|
|
Asn1Object asn1Object;
|
|
if (asn1Object != 0)
|
|
{
|
|
}
|
|
array[0] = asn1Object;
|
|
asn1EncodableVector.Add(array);
|
|
num4++;
|
|
IL_E4:
|
|
DerInteger derInteger = new DerInteger(1);
|
|
DerSet derSet = new DerSet();
|
|
DerSet derSet2 = new DerSet(asn1EncodableVector);
|
|
DerSet derSet3 = new DerSet();
|
|
SignedData signedData = new SignedData(derInteger, derSet, num3, derSet2, num4, derSet3);
|
|
ContentInfo contentInfo2 = new ContentInfo(PkcsObjectIdentifiers.SignedData, signedData);
|
|
return this.ToDerEncoded(contentInfo2);
|
|
Block_10:
|
|
Asn1Object asn1Object2 = this.ToAsn1Object(num5);
|
|
if (asn1Object2 != 0)
|
|
{
|
|
}
|
|
array2[0] = asn1Object2;
|
|
Asn1EncodableVector asn1EncodableVector2;
|
|
asn1EncodableVector2.Add(array2);
|
|
DerSequence derSequence = new DerSequence(asn1EncodableVector2);
|
|
throw new NullReferenceException();
|
|
IL_1AA:
|
|
string text;
|
|
CertificateEncodingException ex = new CertificateEncodingException(text);
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x170014D5 RID: 5333
|
|
// (get) Token: 0x06007F37 RID: 32567 RVA: 0x001AAC94 File Offset: 0x001A8E94
|
|
[Token(Token = "0x170014D5")]
|
|
public virtual IList Certificates
|
|
{
|
|
[Token(Token = "0x6007F37")]
|
|
[Address(RVA = "0x4F3C00", Offset = "0x4F2600", VA = "0x1804F3C00", Slot = "7")]
|
|
get
|
|
{
|
|
return CollectionUtilities.ReadOnly(this.certificates);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06007F38 RID: 32568 RVA: 0x001AACAC File Offset: 0x001A8EAC
|
|
[Token(Token = "0x6007F38")]
|
|
[Address(RVA = "0x4F3230", Offset = "0x4F1C30", VA = "0x1804F3230")]
|
|
private Asn1Object ToAsn1Object(X509Certificate cert)
|
|
{
|
|
AsymmetricKeyParameter publicKey = cert.GetPublicKey();
|
|
Asn1Object asn1Object;
|
|
return asn1Object;
|
|
}
|
|
|
|
// Token: 0x06007F39 RID: 32569 RVA: 0x001AACC8 File Offset: 0x001A8EC8
|
|
[Token(Token = "0x6007F39")]
|
|
[Address(RVA = "0x4F32E0", Offset = "0x4F1CE0", VA = "0x1804F32E0")]
|
|
private byte[] ToDerEncoded(Asn1Encodable obj)
|
|
{
|
|
return obj.GetEncoded("DER");
|
|
}
|
|
|
|
// Token: 0x04005A97 RID: 23191
|
|
[Token(Token = "0x4005A97")]
|
|
internal static readonly IList certPathEncodings = CollectionUtilities.ReadOnly(Platform.CreateArrayList());
|
|
|
|
// Token: 0x04005A98 RID: 23192
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4005A98")]
|
|
private readonly IList certificates;
|
|
}
|
|
}
|