227 lines
7.7 KiB
C#
227 lines
7.7 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using System.Text;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Encoders;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem
|
|
{
|
|
// Token: 0x02001948 RID: 6472
|
|
[Token(Token = "0x2001948")]
|
|
public class PemWriter
|
|
{
|
|
// Token: 0x0600999A RID: 39322 RVA: 0x001FDA60 File Offset: 0x001FBC60
|
|
[Token(Token = "0x600999A")]
|
|
[Address(RVA = "0x18E64E0", Offset = "0x18E52E0", VA = "0x1818E64E0")]
|
|
public PemWriter(TextWriter writer)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600999A)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem.PemWriter::.ctor(System.IO.TextWriter)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_33:
|
|
stloc:ArgumentNullException(var_2_3D, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("writer")))
|
|
}
|
|
|
|
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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
|
|
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: 0x17001879 RID: 6265
|
|
// (get) Token: 0x0600999B RID: 39323 RVA: 0x001FDAAC File Offset: 0x001FBCAC
|
|
[Token(Token = "0x17001879")]
|
|
public TextWriter Writer
|
|
{
|
|
[Token(Token = "0x600999B")]
|
|
[Address(RVA = "0x3F6E20", Offset = "0x3F5C20", VA = "0x1803F6E20")]
|
|
get
|
|
{
|
|
return this.writer;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600999C RID: 39324 RVA: 0x001FDAC0 File Offset: 0x001FBCC0
|
|
[Token(Token = "0x600999C")]
|
|
[Address(RVA = "0x18E5A40", Offset = "0x18E4840", VA = "0x1818E5A40")]
|
|
public int GetOutputSize(PemObject obj)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
num = 0;
|
|
string type = obj.type;
|
|
IList headers = obj.headers;
|
|
if (type <= 0)
|
|
{
|
|
break;
|
|
}
|
|
IList headers2 = obj.headers;
|
|
int num3;
|
|
if (type != 0)
|
|
{
|
|
if (num < type)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
ulong num2;
|
|
num2 += (ulong)1L;
|
|
if (type == 0)
|
|
{
|
|
goto IL_82;
|
|
}
|
|
int stringLength = type.ToString().m_stringLength;
|
|
num3 += stringLength;
|
|
}
|
|
if (num3 != 0)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
int num4 = obj.content.Length;
|
|
num4 += 2;
|
|
throw new NullReferenceException();
|
|
IL_82:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600999D RID: 39325 RVA: 0x001FDB5C File Offset: 0x001FBD5C
|
|
[Token(Token = "0x600999D")]
|
|
[Address(RVA = "0x18E5E70", Offset = "0x18E4C70", VA = "0x1818E5E70")]
|
|
public void WriteObject(PemObjectGenerator objGen)
|
|
{
|
|
int num;
|
|
int num2;
|
|
do
|
|
{
|
|
num = 0;
|
|
num += num;
|
|
num++;
|
|
string text;
|
|
if (text <= 0)
|
|
{
|
|
goto IL_46;
|
|
}
|
|
if (text != 0)
|
|
{
|
|
if (num < text)
|
|
{
|
|
num += num;
|
|
num++;
|
|
}
|
|
if (text == 0)
|
|
{
|
|
}
|
|
if (text == 0)
|
|
{
|
|
goto IL_BF;
|
|
}
|
|
string text2 = text.ToString();
|
|
}
|
|
num2 = 0;
|
|
int num3;
|
|
if (num3 != 0)
|
|
{
|
|
}
|
|
}
|
|
while (num != 0);
|
|
TextWriter textWriter = this.writer;
|
|
IL_46:
|
|
byte[] array;
|
|
if (num2 < array.Length)
|
|
{
|
|
char[] array2 = this.buf;
|
|
int length = array2.Length;
|
|
if (num2 != length && 0 < array.Length)
|
|
{
|
|
byte b;
|
|
array2[0] = (char)b;
|
|
num2++;
|
|
}
|
|
char[] array3 = this.buf;
|
|
}
|
|
string text3 = "-----END " + num2 + "-----";
|
|
return;
|
|
IL_BF:
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600999E RID: 39326 RVA: 0x001FDC30 File Offset: 0x001FBE30
|
|
[Token(Token = "0x600999E")]
|
|
[Address(RVA = "0x18E5D70", Offset = "0x18E4B70", VA = "0x1818E5D70")]
|
|
private void WriteEncoded(byte[] bytes)
|
|
{
|
|
int length = bytes.Length;
|
|
int num = 0;
|
|
byte[] array = Base64.Encode(bytes, num, length);
|
|
int num2 = 0;
|
|
if (num2 < array.Length)
|
|
{
|
|
int num3 = 0;
|
|
char[] array2 = this.buf;
|
|
int length2 = array2.Length;
|
|
if (num3 != length2 && 0 < array.Length)
|
|
{
|
|
num3++;
|
|
byte b;
|
|
array2[0] = (char)b;
|
|
}
|
|
this.writer.WriteLine(array2);
|
|
char[] array3 = this.buf;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600999F RID: 39327 RVA: 0x001FDCB4 File Offset: 0x001FBEB4
|
|
[Token(Token = "0x600999F")]
|
|
[Address(RVA = "0x18E6460", Offset = "0x18E5260", VA = "0x1818E6460")]
|
|
private void WritePreEncapsulationBoundary(string type)
|
|
{
|
|
TextWriter textWriter = this.writer;
|
|
string text = "-----BEGIN " + type + "-----";
|
|
Encoding encoding = textWriter.Encoding;
|
|
}
|
|
|
|
// Token: 0x060099A0 RID: 39328 RVA: 0x001FDCE8 File Offset: 0x001FBEE8
|
|
[Token(Token = "0x60099A0")]
|
|
[Address(RVA = "0x18E63E0", Offset = "0x18E51E0", VA = "0x1818E63E0")]
|
|
private void WritePostEncapsulationBoundary(string type)
|
|
{
|
|
TextWriter textWriter = this.writer;
|
|
string text = "-----END " + type + "-----";
|
|
Encoding encoding = textWriter.Encoding;
|
|
}
|
|
|
|
// Token: 0x0400687C RID: 26748
|
|
[Token(Token = "0x400687C")]
|
|
private const int LineLength = 64;
|
|
|
|
// Token: 0x0400687D RID: 26749
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400687D")]
|
|
private readonly TextWriter writer;
|
|
|
|
// Token: 0x0400687E RID: 26750
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400687E")]
|
|
private readonly int nlLength;
|
|
|
|
// Token: 0x0400687F RID: 26751
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400687F")]
|
|
private char[] buf;
|
|
}
|
|
}
|