169 lines
4.8 KiB
C#
169 lines
4.8 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.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509
|
|
{
|
|
// Token: 0x02001324 RID: 4900
|
|
[Token(Token = "0x2001324")]
|
|
[StructLayout(3)]
|
|
public class X509CertPairParser
|
|
{
|
|
// Token: 0x06007ACC RID: 31436 RVA: 0x00198598 File Offset: 0x00196798
|
|
[Token(Token = "0x6007ACC")]
|
|
[Address(RVA = "0x52DF80", Offset = "0x52C980", VA = "0x18052DF80")]
|
|
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: 0x06007ACD RID: 31437 RVA: 0x00198608 File Offset: 0x00196808
|
|
[Token(Token = "0x6007ACD")]
|
|
[Address(RVA = "0x52DC60", Offset = "0x52C660", VA = "0x18052DC60")]
|
|
public X509CertificatePair ReadCertPair(byte[] input)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(input, num != 0);
|
|
num = 0;
|
|
return this.ReadCertPair(memoryStream);
|
|
}
|
|
|
|
// Token: 0x06007ACE RID: 31438 RVA: 0x00198628 File Offset: 0x00196828
|
|
[Token(Token = "0x6007ACE")]
|
|
[Address(RVA = "0x52DE10", Offset = "0x52C810", VA = "0x18052DE10")]
|
|
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: 0x06007ACF RID: 31439 RVA: 0x00198680 File Offset: 0x00196880
|
|
[Token(Token = "0x6007ACF")]
|
|
[Address(RVA = "0x52D970", Offset = "0x52C370", VA = "0x18052D970")]
|
|
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: 0x06007AD0 RID: 31440 RVA: 0x00198754 File Offset: 0x00196954
|
|
[Token(Token = "0x6007AD0")]
|
|
[Address(RVA = "0x52DCD0", Offset = "0x52C6D0", VA = "0x18052DCD0")]
|
|
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: 0x06007AD1 RID: 31441 RVA: 0x00198794 File Offset: 0x00196994
|
|
[Token(Token = "0x6007AD1")]
|
|
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
|
public X509CertPairParser()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0400583E RID: 22590
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400583E")]
|
|
private Stream currentStream;
|
|
}
|
|
}
|