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: 0x020019DF RID: 6623
|
|
[Token(Token = "0x20019DF")]
|
|
public class X509AttrCertParser
|
|
{
|
|
// Token: 0x06009A65 RID: 39525 RVA: 0x0000220F File Offset: 0x0000040F
|
|
[Token(Token = "0x6009A65")]
|
|
[Address(RVA = "0x414550", Offset = "0x413550", VA = "0x180414550")]
|
|
private IX509AttributeCertificate ReadDerCertificate(Asn1InputStream dIn)
|
|
{
|
|
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
|
}
|
|
|
|
// Token: 0x06009A66 RID: 39526 RVA: 0x001F8C84 File Offset: 0x001F6E84
|
|
[Token(Token = "0x6009A66")]
|
|
[Address(RVA = "0x413DE0", Offset = "0x412DE0", VA = "0x180413DE0")]
|
|
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: 0x06009A67 RID: 39527 RVA: 0x001F8CF4 File Offset: 0x001F6EF4
|
|
[Token(Token = "0x6009A67")]
|
|
[Address(RVA = "0x414780", Offset = "0x413780", VA = "0x180414780")]
|
|
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: 0x06009A68 RID: 39528 RVA: 0x001F8D24 File Offset: 0x001F6F24
|
|
[Token(Token = "0x6009A68")]
|
|
[Address(RVA = "0x414230", Offset = "0x413230", VA = "0x180414230")]
|
|
public IX509AttributeCertificate ReadAttrCert(byte[] input)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(input, num != 0);
|
|
num = 0;
|
|
return this.ReadAttrCert(memoryStream);
|
|
}
|
|
|
|
// Token: 0x06009A69 RID: 39529 RVA: 0x001F8D44 File Offset: 0x001F6F44
|
|
[Token(Token = "0x6009A69")]
|
|
[Address(RVA = "0x4142A0", Offset = "0x4132A0", VA = "0x1804142A0")]
|
|
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: 0x06009A6A RID: 39530 RVA: 0x001F8D9C File Offset: 0x001F6F9C
|
|
[Token(Token = "0x6009A6A")]
|
|
[Address(RVA = "0x413F70", Offset = "0x412F70", VA = "0x180413F70")]
|
|
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: 0x06009A6B RID: 39531 RVA: 0x001F8E8C File Offset: 0x001F708C
|
|
[Token(Token = "0x6009A6B")]
|
|
[Address(RVA = "0x414410", Offset = "0x413410", VA = "0x180414410")]
|
|
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: 0x06009A6C RID: 39532 RVA: 0x001F8ECC File Offset: 0x001F70CC
|
|
[Token(Token = "0x6009A6C")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
public X509AttrCertParser()
|
|
{
|
|
}
|
|
|
|
// Token: 0x04006835 RID: 26677
|
|
[Token(Token = "0x4006835")]
|
|
private static readonly PemParser PemAttrCertParser = new PemParser("ATTRIBUTE CERTIFICATE");
|
|
|
|
// Token: 0x04006836 RID: 26678
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006836")]
|
|
private Asn1Set sData;
|
|
|
|
// Token: 0x04006837 RID: 26679
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006837")]
|
|
private int sDataObjectCount;
|
|
|
|
// Token: 0x04006838 RID: 26680
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006838")]
|
|
private Stream currentStream;
|
|
}
|
|
}
|