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: 0x02001A28 RID: 6696
|
|
[Token(Token = "0x2001A28")]
|
|
public class PemWriter
|
|
{
|
|
// Token: 0x06009D68 RID: 40296 RVA: 0x00206AF8 File Offset: 0x00204CF8
|
|
[Token(Token = "0x6009D68")]
|
|
[Address(RVA = "0x4F0070", Offset = "0x4EF070", VA = "0x1804F0070")]
|
|
public PemWriter(TextWriter writer)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009D68)
|
|
|
|
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: 0x17001916 RID: 6422
|
|
// (get) Token: 0x06009D69 RID: 40297 RVA: 0x00206B44 File Offset: 0x00204D44
|
|
[Token(Token = "0x17001916")]
|
|
public TextWriter Writer
|
|
{
|
|
[Token(Token = "0x6009D69")]
|
|
[Address(RVA = "0x411530", Offset = "0x410530", VA = "0x180411530")]
|
|
get
|
|
{
|
|
return this.writer;
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009D6A RID: 40298 RVA: 0x00206B58 File Offset: 0x00204D58
|
|
[Token(Token = "0x6009D6A")]
|
|
[Address(RVA = "0x4EF5D0", Offset = "0x4EE5D0", VA = "0x1804EF5D0")]
|
|
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: 0x06009D6B RID: 40299 RVA: 0x00206BF4 File Offset: 0x00204DF4
|
|
[Token(Token = "0x6009D6B")]
|
|
[Address(RVA = "0x4EFA00", Offset = "0x4EEA00", VA = "0x1804EFA00")]
|
|
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: 0x06009D6C RID: 40300 RVA: 0x00206CC8 File Offset: 0x00204EC8
|
|
[Token(Token = "0x6009D6C")]
|
|
[Address(RVA = "0x4EF900", Offset = "0x4EE900", VA = "0x1804EF900")]
|
|
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: 0x06009D6D RID: 40301 RVA: 0x00206D4C File Offset: 0x00204F4C
|
|
[Token(Token = "0x6009D6D")]
|
|
[Address(RVA = "0x4EFFF0", Offset = "0x4EEFF0", VA = "0x1804EFFF0")]
|
|
private void WritePreEncapsulationBoundary(string type)
|
|
{
|
|
TextWriter textWriter = this.writer;
|
|
string text = "-----BEGIN " + type + "-----";
|
|
Encoding encoding = textWriter.Encoding;
|
|
}
|
|
|
|
// Token: 0x06009D6E RID: 40302 RVA: 0x00206D80 File Offset: 0x00204F80
|
|
[Token(Token = "0x6009D6E")]
|
|
[Address(RVA = "0x4EFF70", Offset = "0x4EEF70", VA = "0x1804EFF70")]
|
|
private void WritePostEncapsulationBoundary(string type)
|
|
{
|
|
TextWriter textWriter = this.writer;
|
|
string text = "-----END " + type + "-----";
|
|
Encoding encoding = textWriter.Encoding;
|
|
}
|
|
|
|
// Token: 0x04006A35 RID: 27189
|
|
[Token(Token = "0x4006A35")]
|
|
private const int LineLength = 64;
|
|
|
|
// Token: 0x04006A36 RID: 27190
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006A36")]
|
|
private readonly TextWriter writer;
|
|
|
|
// Token: 0x04006A37 RID: 27191
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006A37")]
|
|
private readonly int nlLength;
|
|
|
|
// Token: 0x04006A38 RID: 27192
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006A38")]
|
|
private char[] buf;
|
|
}
|
|
}
|