365 lines
11 KiB
C#
365 lines
11 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
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: 0x02001977 RID: 6519
|
|
[Token(Token = "0x2001977")]
|
|
public class PkixCertPath
|
|
{
|
|
// Token: 0x06009B08 RID: 39688 RVA: 0x00201F48 File Offset: 0x00200148
|
|
[Token(Token = "0x6009B08")]
|
|
[Address(RVA = "0x1CD1D30", Offset = "0x1CD0B30", VA = "0x181CD1D30")]
|
|
private static IList SortCerts(IList certs)
|
|
{
|
|
IList list2;
|
|
int num2;
|
|
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);
|
|
num2 = 0;
|
|
if (num2 >= list2)
|
|
{
|
|
goto IL_58;
|
|
}
|
|
if (list2 != 0)
|
|
{
|
|
bool flag2;
|
|
while (!flag2)
|
|
{
|
|
}
|
|
}
|
|
if (-1 != 0)
|
|
{
|
|
}
|
|
if (list2 == 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (18446744073709551615UL != (ulong)(-1L))
|
|
{
|
|
}
|
|
if ((ulong)1L == 0UL)
|
|
{
|
|
}
|
|
num2++;
|
|
IL_58:
|
|
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: 0x06009B09 RID: 39689 RVA: 0x00201FD8 File Offset: 0x002001D8
|
|
[Token(Token = "0x6009B09")]
|
|
[Address(RVA = "0x1CD2660", Offset = "0x1CD1460", VA = "0x181CD2660")]
|
|
public PkixCertPath(ICollection certificates)
|
|
{
|
|
IList list = PkixCertPath.SortCerts(Platform.CreateArrayList(certificates));
|
|
this.certificates = list;
|
|
}
|
|
|
|
// Token: 0x06009B0A RID: 39690 RVA: 0x00202000 File Offset: 0x00200200
|
|
[Token(Token = "0x6009B0A")]
|
|
[Address(RVA = "0x1CD2700", Offset = "0x1CD1500", VA = "0x181CD2700")]
|
|
public PkixCertPath(Stream inStream)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06009B0B RID: 39691 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6009B0B")]
|
|
[Address(RVA = "0x1CD2750", Offset = "0x1CD1550", VA = "0x181CD2750")]
|
|
public PkixCertPath(Stream inStream, string encoding)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x170018D5 RID: 6357
|
|
// (get) Token: 0x06009B0C RID: 39692 RVA: 0x00202010 File Offset: 0x00200210
|
|
[Token(Token = "0x170018D5")]
|
|
public virtual IEnumerable Encodings
|
|
{
|
|
[Token(Token = "0x6009B0C")]
|
|
[Address(RVA = "0x1CD2E20", Offset = "0x1CD1C20", VA = "0x181CD2E20", Slot = "4")]
|
|
get
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009B0C)
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009B0D RID: 39693 RVA: 0x00202028 File Offset: 0x00200228
|
|
[Token(Token = "0x6009B0D")]
|
|
[Address(RVA = "0x1CD11B0", Offset = "0x1CCFFB0", VA = "0x181CD11B0", 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: 0x06009B0E RID: 39694 RVA: 0x00202060 File Offset: 0x00200260
|
|
[Token(Token = "0x6009B0E")]
|
|
[Address(RVA = "0x4E7FC0", Offset = "0x4E6DC0", VA = "0x1804E7FC0", Slot = "2")]
|
|
public override int GetHashCode()
|
|
{
|
|
byte[] array;
|
|
OVRMesh.JAAHPDGFADH jaahpdgfadh = ((OVRMesh.PJPHJNNOBBH)array).POCDCJMHEGL();
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009B0F RID: 39695 RVA: 0x0020207C File Offset: 0x0020027C
|
|
[Token(Token = "0x6009B0F")]
|
|
[Address(RVA = "0x1CD1370", Offset = "0x1CD0170", VA = "0x181CD1370", Slot = "5")]
|
|
public virtual byte[] GetEncoded()
|
|
{
|
|
int num;
|
|
byte[] array;
|
|
do
|
|
{
|
|
num = 0;
|
|
string text = this.ToString();
|
|
if (text != 0)
|
|
{
|
|
while (text == 0)
|
|
{
|
|
}
|
|
while (text == 0)
|
|
{
|
|
}
|
|
if (text == 0)
|
|
{
|
|
goto IL_2F;
|
|
}
|
|
}
|
|
if (array != 0)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
if (num != -1)
|
|
{
|
|
return array;
|
|
}
|
|
throw new NullReferenceException();
|
|
IL_2F:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009B10 RID: 39696 RVA: 0x002020C0 File Offset: 0x002002C0
|
|
[Token(Token = "0x6009B10")]
|
|
[Address(RVA = "0x1CD1530", Offset = "0x1CD0330", VA = "0x181CD1530", 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: 0x170018D6 RID: 6358
|
|
// (get) Token: 0x06009B11 RID: 39697 RVA: 0x002022AC File Offset: 0x002004AC
|
|
[Token(Token = "0x170018D6")]
|
|
public virtual IList Certificates
|
|
{
|
|
[Token(Token = "0x6009B11")]
|
|
[Address(RVA = "0x1CD2E10", Offset = "0x1CD1C10", VA = "0x181CD2E10", Slot = "7")]
|
|
get
|
|
{
|
|
return CollectionUtilities.ReadOnly(this.certificates);
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009B12 RID: 39698 RVA: 0x002022C4 File Offset: 0x002004C4
|
|
[Token(Token = "0x6009B12")]
|
|
[Address(RVA = "0x1CD2440", Offset = "0x1CD1240", VA = "0x181CD2440")]
|
|
private Asn1Object ToAsn1Object(X509Certificate cert)
|
|
{
|
|
AsymmetricKeyParameter publicKey = cert.GetPublicKey();
|
|
Asn1Object asn1Object;
|
|
return asn1Object;
|
|
}
|
|
|
|
// Token: 0x06009B13 RID: 39699 RVA: 0x002022E0 File Offset: 0x002004E0
|
|
[Token(Token = "0x6009B13")]
|
|
[Address(RVA = "0x1CD24F0", Offset = "0x1CD12F0", VA = "0x181CD24F0")]
|
|
private byte[] ToDerEncoded(Asn1Encodable obj)
|
|
{
|
|
return obj.GetEncoded("DER");
|
|
}
|
|
|
|
// Token: 0x040068DA RID: 26842
|
|
[Token(Token = "0x40068DA")]
|
|
internal static readonly IList certPathEncodings = CollectionUtilities.ReadOnly(Platform.CreateArrayList());
|
|
|
|
// Token: 0x040068DB RID: 26843
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40068DB")]
|
|
private readonly IList certificates;
|
|
}
|
|
}
|