253 lines
6.0 KiB
C#
253 lines
6.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1
|
|
{
|
|
// Token: 0x02001D92 RID: 7570
|
|
[Token(Token = "0x2001D92")]
|
|
public class BerOctetString : DerOctetString, IEnumerable
|
|
{
|
|
// Token: 0x0600BF89 RID: 49033 RVA: 0x002B9D0C File Offset: 0x002B7F0C
|
|
[Token(Token = "0x600BF89")]
|
|
[Address(RVA = "0x2645170", Offset = "0x2643F70", VA = "0x182645170")]
|
|
public static BerOctetString FromSequence(Asn1Sequence seq)
|
|
{
|
|
int num;
|
|
IList list;
|
|
do
|
|
{
|
|
num = 0;
|
|
list = Platform.CreateArrayList();
|
|
IEnumerator enumerator = seq.GetEnumerator();
|
|
if (enumerator != 0)
|
|
{
|
|
if (num < enumerator)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
if (enumerator == 0)
|
|
{
|
|
}
|
|
if (enumerator == 0)
|
|
{
|
|
goto IL_6C;
|
|
}
|
|
if (num < enumerator)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
enumerator += enumerator;
|
|
num += 2;
|
|
num += 19;
|
|
}
|
|
if (num != 0)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
byte[] array = BerOctetString.ToBytes(list);
|
|
BerOctetString berOctetString;
|
|
berOctetString.octs = list;
|
|
return berOctetString;
|
|
IL_6C:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600BF8A RID: 49034 RVA: 0x002B9D8C File Offset: 0x002B7F8C
|
|
[Token(Token = "0x600BF8A")]
|
|
[Address(RVA = "0x2645760", Offset = "0x2644560", VA = "0x182645760")]
|
|
private static byte[] ToBytes(IEnumerable octs)
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = 0;
|
|
MemoryStream memoryStream = new MemoryStream();
|
|
if (memoryStream != 0)
|
|
{
|
|
if (num < memoryStream)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
num++;
|
|
num += 19;
|
|
ulong num2;
|
|
num = (int)((ulong)num + num2);
|
|
if (num == 0 || num == 0)
|
|
{
|
|
goto IL_51;
|
|
}
|
|
if (memoryStream.ReadByte() != 0)
|
|
{
|
|
}
|
|
if (num == 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
throw new NullReferenceException();
|
|
IL_51:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600BF8B RID: 49035 RVA: 0x002B9DF8 File Offset: 0x002B7FF8
|
|
[Token(Token = "0x600BF8B")]
|
|
[Address(RVA = "0x2645A50", Offset = "0x2644850", VA = "0x182645A50")]
|
|
public BerOctetString(byte[] str)
|
|
: base(str)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600BF8C RID: 49036 RVA: 0x002B9E0C File Offset: 0x002B800C
|
|
[Token(Token = "0x600BF8C")]
|
|
[Address(RVA = "0x2645A00", Offset = "0x2644800", VA = "0x182645A00")]
|
|
public BerOctetString(IEnumerable octets)
|
|
{
|
|
byte[] array = BerOctetString.ToBytes(octets);
|
|
base..ctor(array);
|
|
this.octs = octets;
|
|
}
|
|
|
|
// Token: 0x0600BF8D RID: 49037 RVA: 0x002B9E30 File Offset: 0x002B8030
|
|
[Token(Token = "0x600BF8D")]
|
|
[Address(RVA = "0x2645A40", Offset = "0x2644840", VA = "0x182645A40")]
|
|
public BerOctetString(Asn1Object obj)
|
|
: base(obj)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600BF8E RID: 49038 RVA: 0x002B9E44 File Offset: 0x002B8044
|
|
[Token(Token = "0x600BF8E")]
|
|
[Address(RVA = "0x2645A60", Offset = "0x2644860", VA = "0x182645A60")]
|
|
public BerOctetString(Asn1Encodable obj)
|
|
{
|
|
Asn1Object asn1Object = obj.ToAsn1Object();
|
|
base..ctor(asn1Object);
|
|
}
|
|
|
|
// Token: 0x0600BF8F RID: 49039 RVA: 0x002B9E68 File Offset: 0x002B8068
|
|
[Token(Token = "0x600BF8F")]
|
|
[Address(RVA = "0x3F6E20", Offset = "0x3F5C20", VA = "0x1803F6E20", Slot = "10")]
|
|
public override byte[] GetOctets()
|
|
{
|
|
return this.str;
|
|
}
|
|
|
|
// Token: 0x0600BF90 RID: 49040 RVA: 0x002B9E7C File Offset: 0x002B807C
|
|
[Token(Token = "0x600BF90")]
|
|
[Address(RVA = "0x2645590", Offset = "0x2644390", VA = "0x182645590", Slot = "11")]
|
|
public IEnumerator GetEnumerator()
|
|
{
|
|
if (this.octs != 0)
|
|
{
|
|
}
|
|
IList list = Platform.CreateArrayList();
|
|
byte[] str = this.str;
|
|
int num = 0;
|
|
if (num < str.Length)
|
|
{
|
|
int num2 = Math.Min(str.Length, 1000);
|
|
num2 -= num;
|
|
num = num2;
|
|
byte[] array = new byte[num2];
|
|
int length = array.Length;
|
|
int num3 = 0;
|
|
Array.Copy(this.str, num, array, num3, length);
|
|
DerOctetString derOctetString = new DerOctetString(array);
|
|
byte[] str2 = this.str;
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600BF91 RID: 49041 RVA: 0x002B9F04 File Offset: 0x002B8104
|
|
[Token(Token = "0x600BF91")]
|
|
[Address(RVA = "0x2645750", Offset = "0x2644550", VA = "0x182645750")]
|
|
[Obsolete]
|
|
public IEnumerator GetObjects()
|
|
{
|
|
return this.GetEnumerator();
|
|
}
|
|
|
|
// Token: 0x0600BF92 RID: 49042 RVA: 0x002B9F18 File Offset: 0x002B8118
|
|
[Token(Token = "0x600BF92")]
|
|
[Address(RVA = "0x2645420", Offset = "0x2644220", VA = "0x182645420")]
|
|
private IList GenerateOcts()
|
|
{
|
|
IList list = Platform.CreateArrayList();
|
|
byte[] str = this.str;
|
|
int num = 0;
|
|
if (num < str.Length)
|
|
{
|
|
int num2 = Math.Min(str.Length, 1000);
|
|
num2 -= num;
|
|
num = num2;
|
|
byte[] array = new byte[num2];
|
|
int length = array.Length;
|
|
int num3 = 0;
|
|
Array.Copy(this.str, num, array, num3, length);
|
|
DerOctetString derOctetString = new DerOctetString(array);
|
|
byte[] str2 = this.str;
|
|
}
|
|
return list;
|
|
}
|
|
|
|
// Token: 0x0600BF93 RID: 49043 RVA: 0x002B9F9C File Offset: 0x002B819C
|
|
[Token(Token = "0x600BF93")]
|
|
[Address(RVA = "0x2644EA0", Offset = "0x2643CA0", VA = "0x182644EA0", Slot = "6")]
|
|
internal override void Encode(DerOutputStream derOut)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
if (derOut == 0 || (derOut == 0 && derOut == 0))
|
|
{
|
|
goto IL_4D;
|
|
}
|
|
IEnumerator enumerator = this.GetEnumerator();
|
|
if (enumerator != 0)
|
|
{
|
|
if (num < enumerator)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
if (num == 0)
|
|
{
|
|
num += num;
|
|
num++;
|
|
num += 19;
|
|
}
|
|
if (num == 0)
|
|
{
|
|
goto IL_55;
|
|
}
|
|
derOut.WriteObject(num);
|
|
}
|
|
}
|
|
while (num != 0);
|
|
return;
|
|
IL_4D:
|
|
base.Encode(derOut);
|
|
return;
|
|
IL_55:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x04007994 RID: 31124
|
|
[Token(Token = "0x4007994")]
|
|
private const int MaxLength = 1000;
|
|
|
|
// Token: 0x04007995 RID: 31125
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007995")]
|
|
private readonly IEnumerable octs;
|
|
}
|
|
}
|