287 lines
13 KiB
C#
287 lines
13 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1
|
|
{
|
|
// Token: 0x02001D73 RID: 7539
|
|
[Token(Token = "0x2001D73")]
|
|
public class Asn1StreamParser
|
|
{
|
|
// Token: 0x0600BEDA RID: 48858 RVA: 0x002B7B54 File Offset: 0x002B5D54
|
|
[Token(Token = "0x600BEDA")]
|
|
[Address(RVA = "0x2642F00", Offset = "0x2641D00", VA = "0x182642F00")]
|
|
public Asn1StreamParser(Stream inStream)
|
|
{
|
|
int num = Asn1InputStream.FindLimit(inStream);
|
|
}
|
|
|
|
// Token: 0x0600BEDB RID: 48859 RVA: 0x002B7B68 File Offset: 0x002B5D68
|
|
[Token(Token = "0x600BEDB")]
|
|
[Address(RVA = "0x2642DB0", Offset = "0x2641BB0", VA = "0x182642DB0")]
|
|
public Asn1StreamParser(Stream inStream, int limit)
|
|
{
|
|
inStream.Dispose();
|
|
this._in = inStream;
|
|
this._limit = limit;
|
|
byte[][] array = new byte[16][];
|
|
this.tmpBuffers = array;
|
|
}
|
|
|
|
// Token: 0x0600BEDC RID: 48860 RVA: 0x002B7BB4 File Offset: 0x002B5DB4
|
|
[Token(Token = "0x600BEDC")]
|
|
[Address(RVA = "0x2642E80", Offset = "0x2641C80", VA = "0x182642E80")]
|
|
public Asn1StreamParser(byte[] encoding)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(encoding, num != 0);
|
|
num = 0;
|
|
int length = encoding.Length;
|
|
}
|
|
|
|
// Token: 0x0600BEDD RID: 48861 RVA: 0x002B7BD8 File Offset: 0x002B5DD8
|
|
[Token(Token = "0x600BEDD")]
|
|
[Address(RVA = "0x2642040", Offset = "0x2640E40", VA = "0x182642040")]
|
|
internal IAsn1Convertible ReadIndef(int tagValue)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BEDD)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.IAsn1Convertible BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Asn1StreamParser::ReadIndef(System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
Block_0:
|
|
stfld:Asn1StreamParser(BerOctetStringParser::_parser, ldloc:BerOctetStringParser(var_0), ldloc:Asn1StreamParser(this))
|
|
stloc:DerExternalParser(var_1_0D, newobj:DerExternalParser(DerExternalParser::.ctor, ldloc:Asn1StreamParser(this)))
|
|
stloc:Asn1Exception(var_3_1E, newobj:Asn1Exception(Asn1Exception::.ctor, call:string(string::Concat, ldstr:string("unknown BER object encountered: 0x"), ldloc:string(var_2))))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600BEDE RID: 48862 RVA: 0x002B7C04 File Offset: 0x002B5E04
|
|
[Token(Token = "0x600BEDE")]
|
|
[Address(RVA = "0x2641E00", Offset = "0x2640C00", VA = "0x182641E00")]
|
|
internal IAsn1Convertible ReadImplicit(bool constructed, int tag)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600BEDE)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.IAsn1Convertible BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Asn1StreamParser::ReadImplicit(System.Boolean,System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_79:
|
|
stloc:Asn1Exception(var_10_83, newobj:Asn1Exception(Asn1Exception::.ctor, ldstr:string("implicit tagging not implemented")))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x0600BEDF RID: 48863 RVA: 0x002B7C98 File Offset: 0x002B5E98
|
|
[Token(Token = "0x600BEDF")]
|
|
[Address(RVA = "0x2642720", Offset = "0x2641520", VA = "0x182642720")]
|
|
internal Asn1Object ReadTaggedObject(bool constructed, int tag)
|
|
{
|
|
Stream in2;
|
|
do
|
|
{
|
|
if (constructed)
|
|
{
|
|
Asn1EncodableVector asn1EncodableVector = this.ReadVector();
|
|
Stream @in = this._in;
|
|
if (@in != 0 && @in != 0)
|
|
{
|
|
IList v = asn1EncodableVector.v;
|
|
if (@in == (ulong)1L)
|
|
{
|
|
int num = 0;
|
|
Asn1Encodable asn1Encodable = asn1EncodableVector[num];
|
|
BerTaggedObject berTaggedObject = new BerTaggedObject(true, tag, asn1Encodable);
|
|
}
|
|
IList v2 = asn1EncodableVector.v;
|
|
if (@in < (ulong)1L)
|
|
{
|
|
}
|
|
BerSequence berSequence = new BerSequence(asn1EncodableVector);
|
|
}
|
|
IList v3 = asn1EncodableVector.v;
|
|
if (asn1EncodableVector == (ulong)1L)
|
|
{
|
|
int num2 = 0;
|
|
Asn1Encodable asn1Encodable2 = asn1EncodableVector[num2];
|
|
}
|
|
DerSequence derSequence = DerSequence.FromVector(asn1EncodableVector);
|
|
}
|
|
in2 = this._in;
|
|
}
|
|
while (in2 == 0);
|
|
byte[] array;
|
|
DerOctetString derOctetString = new DerOctetString(array);
|
|
int num3;
|
|
DerTaggedObject derTaggedObject = new DerTaggedObject(num3 != 0, tag, derOctetString);
|
|
num3 = 0;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600BEE0 RID: 48864 RVA: 0x002B7D5C File Offset: 0x002B5F5C
|
|
[Token(Token = "0x600BEE0")]
|
|
[Address(RVA = "0x2642150", Offset = "0x2640F50", VA = "0x182642150", Slot = "4")]
|
|
public virtual IAsn1Convertible ReadObject()
|
|
{
|
|
int num;
|
|
int num2;
|
|
int num8;
|
|
for (;;)
|
|
{
|
|
Stream @in = this._in;
|
|
if (num == -1)
|
|
{
|
|
goto IL_164;
|
|
}
|
|
Stream in2 = this._in;
|
|
if (in2 == 0 || in2 == 0 || (in2 != 0 && in2 != 0))
|
|
{
|
|
num2 = Asn1InputStream.ReadTagNumber(in2, num);
|
|
int num3 = 0;
|
|
int limit = this._limit;
|
|
int num4 = Asn1InputStream.ReadLength(this._in, limit);
|
|
DefiniteLengthInputStream definiteLengthInputStream = new DefiniteLengthInputStream(this._in, num3);
|
|
if (num == 64)
|
|
{
|
|
if (num == 0)
|
|
{
|
|
if (num2 != 4)
|
|
{
|
|
byte[][] array = this.tmpBuffers;
|
|
Asn1Object asn1Object = Asn1InputStream.CreatePrimitiveDerObject(num2, definiteLengthInputStream, array);
|
|
}
|
|
DerOctetStringParser derOctetStringParser = new DerOctetStringParser(definiteLengthInputStream);
|
|
}
|
|
if (num2 > 8)
|
|
{
|
|
if (num2 == 16)
|
|
{
|
|
int num5 = Asn1InputStream.FindLimit(definiteLengthInputStream);
|
|
Asn1StreamParser asn1StreamParser;
|
|
DerSequenceParser derSequenceParser = new DerSequenceParser(asn1StreamParser);
|
|
}
|
|
if (num2 != 17)
|
|
{
|
|
continue;
|
|
}
|
|
int num6 = Asn1InputStream.FindLimit(definiteLengthInputStream);
|
|
Asn1StreamParser asn1StreamParser2;
|
|
DerSetParser derSetParser = new DerSetParser(asn1StreamParser2);
|
|
}
|
|
int num7;
|
|
if (num2 == 4)
|
|
{
|
|
num7 = Asn1InputStream.FindLimit(definiteLengthInputStream);
|
|
BerOctetStringParser berOctetStringParser;
|
|
Asn1StreamParser asn1StreamParser3;
|
|
berOctetStringParser._parser = asn1StreamParser3;
|
|
}
|
|
if (num2 != 8)
|
|
{
|
|
continue;
|
|
}
|
|
num7 = Asn1InputStream.FindLimit(definiteLengthInputStream);
|
|
Asn1StreamParser asn1StreamParser4;
|
|
DerExternalParser derExternalParser = new DerExternalParser(asn1StreamParser4);
|
|
num8 = Asn1InputStream.FindLimit(definiteLengthInputStream);
|
|
num8 = num2;
|
|
}
|
|
int num9 = 0;
|
|
byte[] array2 = definiteLengthInputStream.ToArray();
|
|
DerApplicationSpecific derApplicationSpecific = new DerApplicationSpecific(num9 != 0, num8, array2);
|
|
num8 = num2;
|
|
if (derApplicationSpecific != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
Asn1StreamParser asn1StreamParser5 = new Asn1StreamParser(new IndefiniteLengthInputStream(this._in, num8), num8);
|
|
if (num == 64)
|
|
{
|
|
IAsn1Convertible asn1Convertible = asn1StreamParser5.ReadIndef(num2);
|
|
}
|
|
BerApplicationSpecificParser berApplicationSpecificParser;
|
|
berApplicationSpecificParser.tag = num2;
|
|
berApplicationSpecificParser.parser = asn1StreamParser5;
|
|
IL_164:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600BEE1 RID: 48865 RVA: 0x002B7ED4 File Offset: 0x002B60D4
|
|
[Token(Token = "0x600BEE1")]
|
|
[Address(RVA = "0x2642C90", Offset = "0x2641A90", VA = "0x182642C90")]
|
|
private void Set00Check(bool enabled)
|
|
{
|
|
Stream @in;
|
|
do
|
|
{
|
|
@in = this._in;
|
|
}
|
|
while (@in != 0 && @in != 0 && (@in == 0 || @in == 0));
|
|
}
|
|
|
|
// Token: 0x0600BEE2 RID: 48866 RVA: 0x002B7F04 File Offset: 0x002B6104
|
|
[Token(Token = "0x600BEE2")]
|
|
[Address(RVA = "0x2642AC0", Offset = "0x26418C0", VA = "0x182642AC0")]
|
|
internal Asn1EncodableVector ReadVector()
|
|
{
|
|
Asn1EncodableVector asn1EncodableVector;
|
|
while (asn1EncodableVector != 0)
|
|
{
|
|
int num = 0;
|
|
Asn1Encodable[] array = new Asn1Encodable[1];
|
|
num += num;
|
|
num++;
|
|
if (array != 0)
|
|
{
|
|
}
|
|
array[0] = array;
|
|
asn1EncodableVector.Add(array);
|
|
if (this.ToString() == 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
return asn1EncodableVector;
|
|
}
|
|
|
|
// Token: 0x04007954 RID: 31060
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007954")]
|
|
private readonly Stream _in;
|
|
|
|
// Token: 0x04007955 RID: 31061
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007955")]
|
|
private readonly int _limit;
|
|
|
|
// Token: 0x04007956 RID: 31062
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007956")]
|
|
private readonly byte[][] tmpBuffers;
|
|
}
|
|
}
|