Files
Jan2021-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Cms/CmsUtilities.cs
T
2026-04-08 23:40:05 +02:00

305 lines
7.9 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.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: 0x02001775 RID: 6005
[Token(Token = "0x2001775")]
[StructLayout(3)]
internal class CmsUtilities
{
// Token: 0x17001970 RID: 6512
// (get) Token: 0x0600A251 RID: 41553 RVA: 0x0025CBB8 File Offset: 0x0025ADB8
[Token(Token = "0x17001970")]
internal static int MaximumMemory
{
[Token(Token = "0x600A251")]
[Address(RVA = "0x1C863D0", Offset = "0x1C84DD0", VA = "0x181C863D0")]
get
{
return int.MaxValue;
}
}
// Token: 0x0600A252 RID: 41554 RVA: 0x0025CBCC File Offset: 0x0025ADCC
[Token(Token = "0x600A252")]
[Address(RVA = "0x1C861E0", Offset = "0x1C84BE0", VA = "0x181C861E0")]
internal static ContentInfo ReadContentInfo(byte[] input)
{
return CmsUtilities.ReadContentInfo(new Asn1InputStream(input));
}
// Token: 0x0600A253 RID: 41555 RVA: 0x0025CBE4 File Offset: 0x0025ADE4
[Token(Token = "0x600A253")]
[Address(RVA = "0x1C86240", Offset = "0x1C84C40", VA = "0x181C86240")]
internal static ContentInfo ReadContentInfo(Stream input)
{
return CmsUtilities.ReadContentInfo(new Asn1InputStream(input, int.MaxValue));
}
// Token: 0x0600A254 RID: 41556 RVA: 0x0025CC04 File Offset: 0x0025AE04
[Token(Token = "0x600A254")]
[Address(RVA = "0x1C862A0", Offset = "0x1C84CA0", VA = "0x181C862A0")]
private static ContentInfo ReadContentInfo(Asn1InputStream aIn)
{
return ContentInfo.GetInstance(aIn.ReadObject());
}
// Token: 0x0600A255 RID: 41557 RVA: 0x0025CC24 File Offset: 0x0025AE24
[Token(Token = "0x600A255")]
[Address(RVA = "0x1C863B0", Offset = "0x1C84DB0", VA = "0x181C863B0")]
public static byte[] StreamToByteArray(Stream inStream)
{
return Streams.ReadAll(inStream);
}
// Token: 0x0600A256 RID: 41558 RVA: 0x0025CC38 File Offset: 0x0025AE38
[Token(Token = "0x600A256")]
[Address(RVA = "0x1C863C0", Offset = "0x1C84DC0", VA = "0x181C863C0")]
public static byte[] StreamToByteArray(Stream inStream, int limit)
{
return Streams.ReadAllLimited(inStream, limit);
}
// Token: 0x0600A257 RID: 41559 RVA: 0x0025CC4C File Offset: 0x0025AE4C
[Token(Token = "0x600A257")]
[Address(RVA = "0x1C85A30", Offset = "0x1C84430", VA = "0x181C85A30")]
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 != -1)
{
}
if (num != 0)
{
throw new NullReferenceException();
}
}
return list;
}
// Token: 0x0600A258 RID: 41560 RVA: 0x0025CCD0 File Offset: 0x0025AED0
[Token(Token = "0x600A258")]
[Address(RVA = "0x1C85D90", Offset = "0x1C84790", VA = "0x181C85D90")]
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 != -1)
{
}
if (num != 0)
{
throw new NullReferenceException();
}
}
return list;
}
// Token: 0x0600A259 RID: 41561 RVA: 0x0025CD54 File Offset: 0x0025AF54
[Token(Token = "0x600A259")]
[Address(RVA = "0x1C85490", Offset = "0x1C83E90", VA = "0x181C85490")]
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_75;
}
array = new Asn1Encodable[1];
if (num != 0)
{
}
array[0] = num;
asn1EncodableVector.Add(array);
}
if (array != 0)
{
}
if (num != -1)
{
}
}
while (num != 0);
BerSet berSet = new BerSet(asn1EncodableVector);
throw new NullReferenceException();
IL_75:
throw new NullReferenceException();
}
// Token: 0x0600A25A RID: 41562 RVA: 0x0025CDDC File Offset: 0x0025AFDC
[Token(Token = "0x600A25A")]
[Address(RVA = "0x1C85760", Offset = "0x1C84160", VA = "0x181C85760")]
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_75;
}
array = new Asn1Encodable[1];
if (num != 0)
{
}
array[0] = num;
asn1EncodableVector.Add(array);
}
if (array != 0)
{
}
if (num != -1)
{
}
}
while (num != 0);
DerSet derSet = new DerSet(asn1EncodableVector);
throw new NullReferenceException();
IL_75:
throw new NullReferenceException();
}
// Token: 0x0600A25B RID: 41563 RVA: 0x0025CE64 File Offset: 0x0025B064
[Token(Token = "0x600A25B")]
[Address(RVA = "0x1C853F0", Offset = "0x1C83DF0", VA = "0x181C853F0")]
internal static Stream CreateBerOctetOutputStream(Stream s, int tagNo, bool isExplicit, int bufferSize)
{
return new BerOctetStringGenerator(s, tagNo, isExplicit).GetOctetOutputStream(bufferSize);
}
// Token: 0x0600A25C RID: 41564 RVA: 0x0025CE88 File Offset: 0x0025B088
[Token(Token = "0x600A25C")]
[Address(RVA = "0x1C861A0", Offset = "0x1C84BA0", VA = "0x181C861A0")]
internal static TbsCertificateStructure GetTbsCertificateStructure(X509Certificate cert)
{
DateTime notAfter = cert.NotAfter;
Asn1Object asn1Object;
return TbsCertificateStructure.GetInstance(asn1Object);
}
// Token: 0x0600A25D RID: 41565 RVA: 0x0025CEA8 File Offset: 0x0025B0A8
[Token(Token = "0x600A25D")]
[Address(RVA = "0x1C860F0", Offset = "0x1C84AF0", VA = "0x181C860F0")]
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: 0x0600A25E RID: 41566 RVA: 0x0025CEEC File Offset: 0x0025B0EC
[Token(Token = "0x600A25E")]
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
public CmsUtilities()
{
}
}
}