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: 0x02001901 RID: 6401
|
|
[Token(Token = "0x2001901")]
|
|
public class X509CertPairParser
|
|
{
|
|
// Token: 0x060096A6 RID: 38566 RVA: 0x001EFF74 File Offset: 0x001EE174
|
|
[Token(Token = "0x60096A6")]
|
|
[Address(RVA = "0x1628F80", Offset = "0x1627D80", VA = "0x181628F80")]
|
|
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: 0x060096A7 RID: 38567 RVA: 0x001EFFE4 File Offset: 0x001EE1E4
|
|
[Token(Token = "0x60096A7")]
|
|
[Address(RVA = "0x1628C60", Offset = "0x1627A60", VA = "0x181628C60")]
|
|
public X509CertificatePair ReadCertPair(byte[] input)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(input, num != 0);
|
|
num = 0;
|
|
return this.ReadCertPair(memoryStream);
|
|
}
|
|
|
|
// Token: 0x060096A8 RID: 38568 RVA: 0x001F0004 File Offset: 0x001EE204
|
|
[Token(Token = "0x60096A8")]
|
|
[Address(RVA = "0x1628E10", Offset = "0x1627C10", VA = "0x181628E10")]
|
|
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: 0x060096A9 RID: 38569 RVA: 0x001F005C File Offset: 0x001EE25C
|
|
[Token(Token = "0x60096A9")]
|
|
[Address(RVA = "0x1628970", Offset = "0x1627770", VA = "0x181628970")]
|
|
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: 0x060096AA RID: 38570 RVA: 0x001F0130 File Offset: 0x001EE330
|
|
[Token(Token = "0x60096AA")]
|
|
[Address(RVA = "0x1628CD0", Offset = "0x1627AD0", VA = "0x181628CD0")]
|
|
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: 0x060096AB RID: 38571 RVA: 0x001F0170 File Offset: 0x001EE370
|
|
[Token(Token = "0x60096AB")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
public X509CertPairParser()
|
|
{
|
|
}
|
|
|
|
// Token: 0x04006681 RID: 26241
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006681")]
|
|
private Stream currentStream;
|
|
}
|
|
}
|