167 lines
4.7 KiB
C#
167 lines
4.7 KiB
C#
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: 0x020019E1 RID: 6625
|
|
[Token(Token = "0x20019E1")]
|
|
public class X509CertPairParser
|
|
{
|
|
// Token: 0x06009A74 RID: 39540 RVA: 0x001F900C File Offset: 0x001F720C
|
|
[Token(Token = "0x6009A74")]
|
|
[Address(RVA = "0x416180", Offset = "0x415180", VA = "0x180416180")]
|
|
private X509CertificatePair ReadDerCrossCertificatePair(Stream inStream)
|
|
{
|
|
Asn1Object asn1Object;
|
|
do
|
|
{
|
|
asn1Object = new Asn1InputStream(inStream).ReadObject();
|
|
if (asn1Object == 0)
|
|
{
|
|
}
|
|
}
|
|
while (asn1Object == 0);
|
|
CertificatePair instance = CertificatePair.GetInstance(asn1Object);
|
|
X509CertificateStructure forward = instance.forward;
|
|
X509CertificatePair x509CertificatePair;
|
|
if (forward != 0)
|
|
{
|
|
X509Certificate x509Certificate = new X509Certificate(forward);
|
|
x509CertificatePair.forward = x509Certificate;
|
|
}
|
|
X509CertificateStructure reverse = instance.reverse;
|
|
if (reverse != 0)
|
|
{
|
|
X509Certificate x509Certificate2 = new X509Certificate(reverse);
|
|
x509CertificatePair.reverse = x509Certificate2;
|
|
}
|
|
return x509CertificatePair;
|
|
}
|
|
|
|
// Token: 0x06009A75 RID: 39541 RVA: 0x001F907C File Offset: 0x001F727C
|
|
[Token(Token = "0x6009A75")]
|
|
[Address(RVA = "0x415E60", Offset = "0x414E60", VA = "0x180415E60")]
|
|
public X509CertificatePair ReadCertPair(byte[] input)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(input, num != 0);
|
|
num = 0;
|
|
return this.ReadCertPair(memoryStream);
|
|
}
|
|
|
|
// Token: 0x06009A76 RID: 39542 RVA: 0x001F909C File Offset: 0x001F729C
|
|
[Token(Token = "0x6009A76")]
|
|
[Address(RVA = "0x416010", Offset = "0x415010", VA = "0x180416010")]
|
|
public ICollection ReadCertPairs(byte[] input)
|
|
{
|
|
MemoryStream memoryStream;
|
|
do
|
|
{
|
|
int num;
|
|
memoryStream = new MemoryStream(input, num != 0);
|
|
num = 0;
|
|
IList list = Platform.CreateArrayList();
|
|
int num2 = 0;
|
|
if (this.ReadCertPair(memoryStream) == 0)
|
|
{
|
|
break;
|
|
}
|
|
int num3 = 0;
|
|
if (num3 < num2)
|
|
{
|
|
num3 += num3;
|
|
num3++;
|
|
}
|
|
}
|
|
while (this.ReadCertPair(memoryStream) != 0);
|
|
memoryStream += memoryStream;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009A77 RID: 39543 RVA: 0x001F90F4 File Offset: 0x001F72F4
|
|
[Token(Token = "0x6009A77")]
|
|
[Address(RVA = "0x415B70", Offset = "0x414B70", VA = "0x180415B70")]
|
|
public X509CertificatePair ReadCertPair(Stream inStream)
|
|
{
|
|
if (inStream != 0)
|
|
{
|
|
inStream.Dispose();
|
|
Stream stream = this.currentStream;
|
|
if (stream == 0 || stream != inStream)
|
|
{
|
|
this.currentStream = inStream;
|
|
}
|
|
PushbackStream pushbackStream = new PushbackStream(inStream);
|
|
int num;
|
|
pushbackStream.WriteByte((byte)num);
|
|
Asn1Object asn1Object = new Asn1InputStream(pushbackStream).ReadObject();
|
|
if (asn1Object == 0)
|
|
{
|
|
}
|
|
if (asn1Object == 0)
|
|
{
|
|
throw new NullReferenceException();
|
|
}
|
|
CertificatePair instance = CertificatePair.GetInstance(asn1Object);
|
|
X509CertificateStructure forward = instance.forward;
|
|
X509CertificatePair x509CertificatePair;
|
|
if (forward != 0)
|
|
{
|
|
X509Certificate x509Certificate = new X509Certificate(forward);
|
|
x509CertificatePair.forward = x509Certificate;
|
|
}
|
|
X509CertificateStructure reverse = instance.reverse;
|
|
if (reverse != 0)
|
|
{
|
|
X509Certificate x509Certificate2 = new X509Certificate(reverse);
|
|
x509CertificatePair.reverse = x509Certificate2;
|
|
}
|
|
}
|
|
ArgumentNullException ex = new ArgumentNullException("inStream");
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009A78 RID: 39544 RVA: 0x001F91C8 File Offset: 0x001F73C8
|
|
[Token(Token = "0x6009A78")]
|
|
[Address(RVA = "0x415ED0", Offset = "0x414ED0", VA = "0x180415ED0")]
|
|
public ICollection ReadCertPairs(Stream inStream)
|
|
{
|
|
do
|
|
{
|
|
IList list = Platform.CreateArrayList();
|
|
int num = 0;
|
|
if (this.ReadCertPair(inStream) == 0)
|
|
{
|
|
break;
|
|
}
|
|
int num2 = 0;
|
|
if (num2 < num)
|
|
{
|
|
num2 += num2;
|
|
num2++;
|
|
}
|
|
}
|
|
while (this.ReadCertPair(inStream) != 0);
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009A79 RID: 39545 RVA: 0x001F9208 File Offset: 0x001F7408
|
|
[Token(Token = "0x6009A79")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
public X509CertPairParser()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0400683A RID: 26682
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400683A")]
|
|
private Stream currentStream;
|
|
}
|
|
}
|