Files
Apr2020-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Cms/CmsUtilities.cs
T
niko 8fc35183db a
2026-04-11 22:19:20 +02:00

291 lines
7.7 KiB
C#

using System;
using System.Collections;
using System.IO;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509.Store;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cms
{
// Token: 0x02001D52 RID: 7506
[Token(Token = "0x2001D52")]
internal class CmsUtilities
{
// Token: 0x17001D71 RID: 7537
// (get) Token: 0x0600BE2B RID: 48683 RVA: 0x002B4FD8 File Offset: 0x002B31D8
[Token(Token = "0x17001D71")]
internal static int MaximumMemory
{
[Token(Token = "0x600BE2B")]
[Address(RVA = "0x2005640", Offset = "0x2004440", VA = "0x182005640")]
get
{
return int.MaxValue;
}
}
// Token: 0x0600BE2C RID: 48684 RVA: 0x002B4FEC File Offset: 0x002B31EC
[Token(Token = "0x600BE2C")]
[Address(RVA = "0x2005450", Offset = "0x2004250", VA = "0x182005450")]
internal static ContentInfo ReadContentInfo(byte[] input)
{
return CmsUtilities.ReadContentInfo(new Asn1InputStream(input));
}
// Token: 0x0600BE2D RID: 48685 RVA: 0x002B5004 File Offset: 0x002B3204
[Token(Token = "0x600BE2D")]
[Address(RVA = "0x20054B0", Offset = "0x20042B0", VA = "0x1820054B0")]
internal static ContentInfo ReadContentInfo(Stream input)
{
return CmsUtilities.ReadContentInfo(new Asn1InputStream(input, int.MaxValue));
}
// Token: 0x0600BE2E RID: 48686 RVA: 0x002B5024 File Offset: 0x002B3224
[Token(Token = "0x600BE2E")]
[Address(RVA = "0x2005510", Offset = "0x2004310", VA = "0x182005510")]
private static ContentInfo ReadContentInfo(Asn1InputStream aIn)
{
return ContentInfo.GetInstance(aIn.ReadObject());
}
// Token: 0x0600BE2F RID: 48687 RVA: 0x002B5044 File Offset: 0x002B3244
[Token(Token = "0x600BE2F")]
[Address(RVA = "0x2005620", Offset = "0x2004420", VA = "0x182005620")]
public static byte[] StreamToByteArray(Stream inStream)
{
return Streams.ReadAll(inStream);
}
// Token: 0x0600BE30 RID: 48688 RVA: 0x002B5058 File Offset: 0x002B3258
[Token(Token = "0x600BE30")]
[Address(RVA = "0x2005630", Offset = "0x2004430", VA = "0x182005630")]
public static byte[] StreamToByteArray(Stream inStream, int limit)
{
return Streams.ReadAllLimited(inStream, limit);
}
// Token: 0x0600BE31 RID: 48689 RVA: 0x002B506C File Offset: 0x002B326C
[Token(Token = "0x600BE31")]
[Address(RVA = "0x2004D00", Offset = "0x2003B00", VA = "0x182004D00")]
public static IList GetCertificatesFromStore(IX509Store certStore)
{
int num = 0;
IList list = Platform.CreateArrayList();
if (certStore != 0)
{
if (list != 0)
{
if (num < list)
{
num += num;
num++;
}
ulong num2;
num2 += (ulong)1L;
if (list == 0)
{
throw new NullReferenceException();
}
Asn1Object asn1Object;
X509CertificateStructure x509CertificateStructure = X509CertificateStructure.GetInstance(asn1Object);
if (num < list)
{
num += num;
num++;
}
x509CertificateStructure += x509CertificateStructure;
num += 2;
num += 19;
}
if (num != 0)
{
}
if (num != 0)
{
throw new NullReferenceException();
}
}
return list;
}
// Token: 0x0600BE32 RID: 48690 RVA: 0x002B50EC File Offset: 0x002B32EC
[Token(Token = "0x600BE32")]
[Address(RVA = "0x2005030", Offset = "0x2003E30", VA = "0x182005030")]
public static IList GetCrlsFromStore(IX509Store crlStore)
{
int num = 0;
IList list = Platform.CreateArrayList();
if (crlStore != 0)
{
if (list != 0)
{
if (num < list)
{
num += num;
num++;
}
ulong num2;
num2 += (ulong)1L;
if (list == 0)
{
throw new NullReferenceException();
}
Asn1Object asn1Object;
CertificateList certificateList = CertificateList.GetInstance(asn1Object);
if (num < list)
{
num += num;
num++;
}
certificateList += certificateList;
num += 2;
num += 19;
}
if (num != 0)
{
}
if (num != 0)
{
throw new NullReferenceException();
}
}
return list;
}
// Token: 0x0600BE33 RID: 48691 RVA: 0x002B516C File Offset: 0x002B336C
[Token(Token = "0x600BE33")]
[Address(RVA = "0x20047A0", Offset = "0x20035A0", VA = "0x1820047A0")]
public static Asn1Set CreateBerSetFromList(IList berObjects)
{
int num;
Asn1EncodableVector asn1EncodableVector;
do
{
num = 0;
Asn1Encodable[] array;
if (asn1EncodableVector != 0)
{
if (num < asn1EncodableVector)
{
num += num;
num++;
}
if (num == 0)
{
num++;
num += 19;
}
if (num == 0)
{
goto IL_71;
}
array = new Asn1Encodable[1];
if (num != 0)
{
}
array[0] = num;
asn1EncodableVector.Add(array);
}
if (array != 0)
{
}
}
while (num != 0);
BerSet berSet = new BerSet(asn1EncodableVector);
throw new NullReferenceException();
IL_71:
throw new NullReferenceException();
}
// Token: 0x0600BE34 RID: 48692 RVA: 0x002B51F0 File Offset: 0x002B33F0
[Token(Token = "0x600BE34")]
[Address(RVA = "0x2004A50", Offset = "0x2003850", VA = "0x182004A50")]
public static Asn1Set CreateDerSetFromList(IList derObjects)
{
int num;
Asn1EncodableVector asn1EncodableVector;
do
{
num = 0;
Asn1Encodable[] array;
if (asn1EncodableVector != 0)
{
if (num < asn1EncodableVector)
{
num += num;
num++;
}
if (num == 0)
{
num++;
num += 19;
}
if (num == 0)
{
goto IL_71;
}
array = new Asn1Encodable[1];
if (num != 0)
{
}
array[0] = num;
asn1EncodableVector.Add(array);
}
if (array != 0)
{
}
}
while (num != 0);
DerSet derSet = new DerSet(asn1EncodableVector);
throw new NullReferenceException();
IL_71:
throw new NullReferenceException();
}
// Token: 0x0600BE35 RID: 48693 RVA: 0x002B5274 File Offset: 0x002B3474
[Token(Token = "0x600BE35")]
[Address(RVA = "0x2004700", Offset = "0x2003500", VA = "0x182004700")]
internal static Stream CreateBerOctetOutputStream(Stream s, int tagNo, bool isExplicit, int bufferSize)
{
return new BerOctetStringGenerator(s, tagNo, isExplicit).GetOctetOutputStream(bufferSize);
}
// Token: 0x0600BE36 RID: 48694 RVA: 0x002B5298 File Offset: 0x002B3498
[Token(Token = "0x600BE36")]
[Address(RVA = "0x2005410", Offset = "0x2004210", VA = "0x182005410")]
internal static TbsCertificateStructure GetTbsCertificateStructure(X509Certificate cert)
{
DateTime notAfter = cert.NotAfter;
Asn1Object asn1Object;
return TbsCertificateStructure.GetInstance(asn1Object);
}
// Token: 0x0600BE37 RID: 48695 RVA: 0x002B52B8 File Offset: 0x002B34B8
[Token(Token = "0x600BE37")]
[Address(RVA = "0x2005360", Offset = "0x2004160", VA = "0x182005360")]
internal static IssuerAndSerialNumber GetIssuerAndSerialNumber(X509Certificate cert)
{
DateTime notAfter = cert.NotAfter;
Asn1Object asn1Object;
TbsCertificateStructure instance = TbsCertificateStructure.GetInstance(asn1Object);
DerInteger serialNumber = instance.serialNumber;
X509Name issuer = instance.issuer;
BigInteger value = serialNumber.Value;
return new IssuerAndSerialNumber(issuer, value);
}
// Token: 0x0600BE38 RID: 48696 RVA: 0x002B52FC File Offset: 0x002B34FC
[Token(Token = "0x600BE38")]
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
public CmsUtilities()
{
}
}
}