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: 0x02001E72 RID: 7794
|
|
[Token(Token = "0x2001E72")]
|
|
public class BerOctetString : DerOctetString, IEnumerable
|
|
{
|
|
// Token: 0x0600C357 RID: 50007 RVA: 0x002C2604 File Offset: 0x002C0804
|
|
[Token(Token = "0x600C357")]
|
|
[Address(RVA = "0x2295510", Offset = "0x2294510", VA = "0x182295510")]
|
|
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: 0x0600C358 RID: 50008 RVA: 0x002C2684 File Offset: 0x002C0884
|
|
[Token(Token = "0x600C358")]
|
|
[Address(RVA = "0x2295B00", Offset = "0x2294B00", VA = "0x182295B00")]
|
|
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: 0x0600C359 RID: 50009 RVA: 0x002C26F0 File Offset: 0x002C08F0
|
|
[Token(Token = "0x600C359")]
|
|
[Address(RVA = "0x2295DF0", Offset = "0x2294DF0", VA = "0x182295DF0")]
|
|
public BerOctetString(byte[] str)
|
|
: base(str)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600C35A RID: 50010 RVA: 0x002C2704 File Offset: 0x002C0904
|
|
[Token(Token = "0x600C35A")]
|
|
[Address(RVA = "0x2295DA0", Offset = "0x2294DA0", VA = "0x182295DA0")]
|
|
public BerOctetString(IEnumerable octets)
|
|
{
|
|
byte[] array = BerOctetString.ToBytes(octets);
|
|
base..ctor(array);
|
|
this.octs = octets;
|
|
}
|
|
|
|
// Token: 0x0600C35B RID: 50011 RVA: 0x002C2728 File Offset: 0x002C0928
|
|
[Token(Token = "0x600C35B")]
|
|
[Address(RVA = "0x2295DE0", Offset = "0x2294DE0", VA = "0x182295DE0")]
|
|
public BerOctetString(Asn1Object obj)
|
|
: base(obj)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600C35C RID: 50012 RVA: 0x002C273C File Offset: 0x002C093C
|
|
[Token(Token = "0x600C35C")]
|
|
[Address(RVA = "0x2295E00", Offset = "0x2294E00", VA = "0x182295E00")]
|
|
public BerOctetString(Asn1Encodable obj)
|
|
{
|
|
Asn1Object asn1Object = obj.ToAsn1Object();
|
|
base..ctor(asn1Object);
|
|
}
|
|
|
|
// Token: 0x0600C35D RID: 50013 RVA: 0x002C2760 File Offset: 0x002C0960
|
|
[Token(Token = "0x600C35D")]
|
|
[Address(RVA = "0x411530", Offset = "0x410530", VA = "0x180411530", Slot = "10")]
|
|
public override byte[] GetOctets()
|
|
{
|
|
return this.str;
|
|
}
|
|
|
|
// Token: 0x0600C35E RID: 50014 RVA: 0x002C2774 File Offset: 0x002C0974
|
|
[Token(Token = "0x600C35E")]
|
|
[Address(RVA = "0x2295930", Offset = "0x2294930", VA = "0x182295930", 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: 0x0600C35F RID: 50015 RVA: 0x002C27FC File Offset: 0x002C09FC
|
|
[Token(Token = "0x600C35F")]
|
|
[Address(RVA = "0x2295AF0", Offset = "0x2294AF0", VA = "0x182295AF0")]
|
|
[Obsolete]
|
|
public IEnumerator GetObjects()
|
|
{
|
|
return this.GetEnumerator();
|
|
}
|
|
|
|
// Token: 0x0600C360 RID: 50016 RVA: 0x002C2810 File Offset: 0x002C0A10
|
|
[Token(Token = "0x600C360")]
|
|
[Address(RVA = "0x22957C0", Offset = "0x22947C0", VA = "0x1822957C0")]
|
|
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: 0x0600C361 RID: 50017 RVA: 0x002C2894 File Offset: 0x002C0A94
|
|
[Token(Token = "0x600C361")]
|
|
[Address(RVA = "0x2295240", Offset = "0x2294240", VA = "0x182295240", 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: 0x04007B4D RID: 31565
|
|
[Token(Token = "0x4007B4D")]
|
|
private const int MaxLength = 1000;
|
|
|
|
// Token: 0x04007B4E RID: 31566
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007B4E")]
|
|
private readonly IEnumerable octs;
|
|
}
|
|
}
|