m
This commit is contained in:
+205
@@ -0,0 +1,205 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509
|
||||
{
|
||||
// Token: 0x020019E4 RID: 6628
|
||||
[Token(Token = "0x20019E4")]
|
||||
public class X509CertificateParser
|
||||
{
|
||||
// Token: 0x06009AA5 RID: 39589 RVA: 0x0000220F File Offset: 0x0000040F
|
||||
[Token(Token = "0x6009AA5")]
|
||||
[Address(RVA = "0x418610", Offset = "0x417610", VA = "0x180418610")]
|
||||
private X509Certificate ReadDerCertificate(Asn1InputStream dIn)
|
||||
{
|
||||
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
||||
}
|
||||
|
||||
// Token: 0x06009AA6 RID: 39590 RVA: 0x001F9E54 File Offset: 0x001F8054
|
||||
[Token(Token = "0x6009AA6")]
|
||||
[Address(RVA = "0x417F30", Offset = "0x416F30", VA = "0x180417F30")]
|
||||
private X509Certificate GetCertificate()
|
||||
{
|
||||
if (this.sData != (ulong)0L)
|
||||
{
|
||||
Asn1Set asn1Set = this.sData;
|
||||
Asn1Encodable asn1Encodable;
|
||||
if (this.sDataObjectCount < asn1Encodable)
|
||||
{
|
||||
int num = this.sDataObjectCount;
|
||||
Asn1Set asn1Set2 = this.sData;
|
||||
int num2 = num + 1;
|
||||
this.sDataObjectCount = num2;
|
||||
IEnumerator enumerator = asn1Set2.GetEnumerator();
|
||||
while (enumerator == 0)
|
||||
{
|
||||
}
|
||||
while (enumerator == 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x06009AA7 RID: 39591 RVA: 0x001F9EB4 File Offset: 0x001F80B4
|
||||
[Token(Token = "0x6009AA7")]
|
||||
[Address(RVA = "0x418830", Offset = "0x417830", VA = "0x180418830")]
|
||||
private X509Certificate ReadPemCertificate(Stream inStream)
|
||||
{
|
||||
Asn1Sequence asn1Sequence = X509CertificateParser.PemCertParser.ReadPemObject(inStream);
|
||||
if (asn1Sequence == 0)
|
||||
{
|
||||
}
|
||||
X509CertificateStructure instance = X509CertificateStructure.GetInstance(asn1Sequence);
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x06009AA8 RID: 39592 RVA: 0x001F9EE0 File Offset: 0x001F80E0
|
||||
[Token(Token = "0x6009AA8")]
|
||||
[Address(RVA = "0x417ED0", Offset = "0x416ED0", VA = "0x180417ED0", Slot = "4")]
|
||||
protected virtual X509Certificate CreateX509Certificate(X509CertificateStructure c)
|
||||
{
|
||||
return new X509Certificate(c);
|
||||
}
|
||||
|
||||
// Token: 0x06009AA9 RID: 39593 RVA: 0x001F9EF4 File Offset: 0x001F80F4
|
||||
[Token(Token = "0x6009AA9")]
|
||||
[Address(RVA = "0x418050", Offset = "0x417050", VA = "0x180418050")]
|
||||
public X509Certificate ReadCertificate(byte[] input)
|
||||
{
|
||||
int num;
|
||||
MemoryStream memoryStream = new MemoryStream(input, num != 0);
|
||||
num = 0;
|
||||
return this.ReadCertificate(memoryStream);
|
||||
}
|
||||
|
||||
// Token: 0x06009AAA RID: 39594 RVA: 0x001F9F14 File Offset: 0x001F8114
|
||||
[Token(Token = "0x6009AAA")]
|
||||
[Address(RVA = "0x418360", Offset = "0x417360", VA = "0x180418360")]
|
||||
public ICollection ReadCertificates(byte[] input)
|
||||
{
|
||||
MemoryStream memoryStream;
|
||||
do
|
||||
{
|
||||
int num;
|
||||
memoryStream = new MemoryStream(input, num != 0);
|
||||
num = 0;
|
||||
IList list = Platform.CreateArrayList();
|
||||
int num2 = 0;
|
||||
if (this.ReadCertificate(memoryStream) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
int num3 = 0;
|
||||
if (num3 < num2)
|
||||
{
|
||||
num3 += num3;
|
||||
num3++;
|
||||
}
|
||||
}
|
||||
while (this.ReadCertificate(memoryStream) != 0);
|
||||
memoryStream += memoryStream;
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x06009AAB RID: 39595 RVA: 0x001F9F6C File Offset: 0x001F816C
|
||||
[Token(Token = "0x6009AAB")]
|
||||
[Address(RVA = "0x4180C0", Offset = "0x4170C0", VA = "0x1804180C0")]
|
||||
public X509Certificate ReadCertificate(Stream inStream)
|
||||
{
|
||||
if (inStream != 0)
|
||||
{
|
||||
inStream.Dispose();
|
||||
Stream stream = this.currentStream;
|
||||
int num = 0;
|
||||
if (stream == 0 || stream != inStream)
|
||||
{
|
||||
this.sDataObjectCount = num;
|
||||
this.sData = num;
|
||||
this.currentStream = inStream;
|
||||
}
|
||||
string text;
|
||||
if (this.sData == 0)
|
||||
{
|
||||
PushbackStream pushbackStream = new PushbackStream(inStream);
|
||||
int num2;
|
||||
pushbackStream.WriteByte((byte)num2);
|
||||
if (num2 == 48)
|
||||
{
|
||||
Asn1InputStream asn1InputStream = new Asn1InputStream(pushbackStream);
|
||||
X509Certificate x509Certificate = this.ReadDerCertificate(asn1InputStream);
|
||||
}
|
||||
Asn1Sequence asn1Sequence = X509CertificateParser.PemCertParser.ReadPemObject(pushbackStream);
|
||||
if (asn1Sequence != 0)
|
||||
{
|
||||
X509CertificateStructure instance = X509CertificateStructure.GetInstance(asn1Sequence);
|
||||
text = this.ToString();
|
||||
}
|
||||
}
|
||||
int num3 = this.sDataObjectCount;
|
||||
this.sData = text;
|
||||
this.sDataObjectCount = text;
|
||||
return this.GetCertificate();
|
||||
}
|
||||
ArgumentNullException ex = new ArgumentNullException("inStream");
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x06009AAC RID: 39596 RVA: 0x001FA058 File Offset: 0x001F8258
|
||||
[Token(Token = "0x6009AAC")]
|
||||
[Address(RVA = "0x4184D0", Offset = "0x4174D0", VA = "0x1804184D0")]
|
||||
public ICollection ReadCertificates(Stream inStream)
|
||||
{
|
||||
do
|
||||
{
|
||||
IList list = Platform.CreateArrayList();
|
||||
int num = 0;
|
||||
if (this.ReadCertificate(inStream) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
int num2 = 0;
|
||||
if (num2 < num)
|
||||
{
|
||||
num2 += num2;
|
||||
num2++;
|
||||
}
|
||||
}
|
||||
while (this.ReadCertificate(inStream) != 0);
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x06009AAD RID: 39597 RVA: 0x001FA098 File Offset: 0x001F8298
|
||||
[Token(Token = "0x6009AAD")]
|
||||
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
||||
public X509CertificateParser()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x04006842 RID: 26690
|
||||
[Token(Token = "0x4006842")]
|
||||
private static readonly PemParser PemCertParser = new PemParser("CERTIFICATE");
|
||||
|
||||
// Token: 0x04006843 RID: 26691
|
||||
[FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4006843")]
|
||||
private Asn1Set sData;
|
||||
|
||||
// Token: 0x04006844 RID: 26692
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4006844")]
|
||||
private int sDataObjectCount;
|
||||
|
||||
// Token: 0x04006845 RID: 26693
|
||||
[FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4006845")]
|
||||
private Stream currentStream;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user