211 lines
6.4 KiB
C#
211 lines
6.4 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.Collections;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509
|
|
{
|
|
// Token: 0x020018FF RID: 6399
|
|
[Token(Token = "0x20018FF")]
|
|
public class X509AttrCertParser
|
|
{
|
|
// Token: 0x06009697 RID: 38551 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6009697")]
|
|
[Address(RVA = "0x1627410", Offset = "0x1626210", VA = "0x181627410")]
|
|
private IX509AttributeCertificate ReadDerCertificate(Asn1InputStream dIn)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06009698 RID: 38552 RVA: 0x001EFBEC File Offset: 0x001EDDEC
|
|
[Token(Token = "0x6009698")]
|
|
[Address(RVA = "0x1626CA0", Offset = "0x1625AA0", VA = "0x181626CA0")]
|
|
private IX509AttributeCertificate GetCertificate()
|
|
{
|
|
while (this.sData != (ulong)0L)
|
|
{
|
|
Asn1Set asn1Set = this.sData;
|
|
Asn1Encodable asn1Encodable;
|
|
if (this.sDataObjectCount >= asn1Encodable)
|
|
{
|
|
return;
|
|
}
|
|
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)
|
|
{
|
|
}
|
|
if (enumerator != 0)
|
|
{
|
|
Asn1Sequence asn1Sequence;
|
|
X509V2AttributeCertificate x509V2AttributeCertificate = new X509V2AttributeCertificate(AttributeCertificate.GetInstance(asn1Sequence));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009699 RID: 38553 RVA: 0x001EFC5C File Offset: 0x001EDE5C
|
|
[Token(Token = "0x6009699")]
|
|
[Address(RVA = "0x1627640", Offset = "0x1626440", VA = "0x181627640")]
|
|
private IX509AttributeCertificate ReadPemCertificate(Stream inStream)
|
|
{
|
|
Asn1Sequence asn1Sequence = X509AttrCertParser.PemAttrCertParser.ReadPemObject(inStream);
|
|
if (asn1Sequence == 0)
|
|
{
|
|
}
|
|
X509V2AttributeCertificate x509V2AttributeCertificate = new X509V2AttributeCertificate(AttributeCertificate.GetInstance(asn1Sequence));
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600969A RID: 38554 RVA: 0x001EFC8C File Offset: 0x001EDE8C
|
|
[Token(Token = "0x600969A")]
|
|
[Address(RVA = "0x16270F0", Offset = "0x1625EF0", VA = "0x1816270F0")]
|
|
public IX509AttributeCertificate ReadAttrCert(byte[] input)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(input, num != 0);
|
|
num = 0;
|
|
return this.ReadAttrCert(memoryStream);
|
|
}
|
|
|
|
// Token: 0x0600969B RID: 38555 RVA: 0x001EFCAC File Offset: 0x001EDEAC
|
|
[Token(Token = "0x600969B")]
|
|
[Address(RVA = "0x1627160", Offset = "0x1625F60", VA = "0x181627160")]
|
|
public ICollection ReadAttrCerts(byte[] input)
|
|
{
|
|
MemoryStream memoryStream;
|
|
do
|
|
{
|
|
int num;
|
|
memoryStream = new MemoryStream(input, num != 0);
|
|
num = 0;
|
|
IList list = Platform.CreateArrayList();
|
|
int num2 = 0;
|
|
if (this.ReadAttrCert(memoryStream) == 0)
|
|
{
|
|
break;
|
|
}
|
|
int num3 = 0;
|
|
if (num3 < num2)
|
|
{
|
|
num3 += num3;
|
|
num3++;
|
|
}
|
|
}
|
|
while (this.ReadAttrCert(memoryStream) != 0);
|
|
memoryStream += memoryStream;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600969C RID: 38556 RVA: 0x001EFD04 File Offset: 0x001EDF04
|
|
[Token(Token = "0x600969C")]
|
|
[Address(RVA = "0x1626E30", Offset = "0x1625C30", VA = "0x181626E30")]
|
|
public IX509AttributeCertificate ReadAttrCert(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;
|
|
}
|
|
AttributeCertificate instance;
|
|
X509V2AttributeCertificate x509V2AttributeCertificate;
|
|
if (this.sData == 0)
|
|
{
|
|
PushbackStream pushbackStream = new PushbackStream(inStream);
|
|
int num2;
|
|
pushbackStream.WriteByte((byte)num2);
|
|
if (num2 == 48)
|
|
{
|
|
Asn1InputStream asn1InputStream = new Asn1InputStream(pushbackStream);
|
|
IX509AttributeCertificate ix509AttributeCertificate = this.ReadDerCertificate(asn1InputStream);
|
|
}
|
|
Asn1Sequence asn1Sequence = X509AttrCertParser.PemAttrCertParser.ReadPemObject(pushbackStream);
|
|
if (asn1Sequence != 0)
|
|
{
|
|
instance = AttributeCertificate.GetInstance(asn1Sequence);
|
|
x509V2AttributeCertificate = new X509V2AttributeCertificate(instance);
|
|
}
|
|
}
|
|
AlgorithmIdentifier signatureAlgorithm = instance.signatureAlgorithm;
|
|
ISet criticalExtensionOids = x509V2AttributeCertificate.GetCriticalExtensionOids();
|
|
if (signatureAlgorithm == criticalExtensionOids)
|
|
{
|
|
instance.acinfo = x509V2AttributeCertificate;
|
|
instance.signatureAlgorithm = x509V2AttributeCertificate;
|
|
}
|
|
IX509AttributeCertificate ix509AttributeCertificate2;
|
|
return ix509AttributeCertificate2;
|
|
}
|
|
ArgumentNullException ex = new ArgumentNullException("inStream");
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600969D RID: 38557 RVA: 0x001EFDF4 File Offset: 0x001EDFF4
|
|
[Token(Token = "0x600969D")]
|
|
[Address(RVA = "0x16272D0", Offset = "0x16260D0", VA = "0x1816272D0")]
|
|
public ICollection ReadAttrCerts(Stream inStream)
|
|
{
|
|
do
|
|
{
|
|
IList list = Platform.CreateArrayList();
|
|
int num = 0;
|
|
if (this.ReadAttrCert(inStream) == 0)
|
|
{
|
|
break;
|
|
}
|
|
int num2 = 0;
|
|
if (num2 < num)
|
|
{
|
|
num2 += num2;
|
|
num2++;
|
|
}
|
|
}
|
|
while (this.ReadAttrCert(inStream) != 0);
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600969E RID: 38558 RVA: 0x001EFE34 File Offset: 0x001EE034
|
|
[Token(Token = "0x600969E")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
public X509AttrCertParser()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0400667C RID: 26236
|
|
[Token(Token = "0x400667C")]
|
|
private static readonly PemParser PemAttrCertParser = new PemParser("ATTRIBUTE CERTIFICATE");
|
|
|
|
// Token: 0x0400667D RID: 26237
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400667D")]
|
|
private Asn1Set sData;
|
|
|
|
// Token: 0x0400667E RID: 26238
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400667E")]
|
|
private int sDataObjectCount;
|
|
|
|
// Token: 0x0400667F RID: 26239
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400667F")]
|
|
private Stream currentStream;
|
|
}
|
|
}
|