scripts
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x020013B8 RID: 5048
|
||||
[Token(Token = "0x20013B8")]
|
||||
[StructLayout(3)]
|
||||
public interface IPasswordFinder
|
||||
{
|
||||
// Token: 0x0600809C RID: 32924
|
||||
[Token(Token = "0x600809C")]
|
||||
[Address(Slot = "0")]
|
||||
char[] GetPassword();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x020013B9 RID: 5049
|
||||
[Token(Token = "0x20013B9")]
|
||||
[StructLayout(3)]
|
||||
public class MiscPemGenerator : PemObjectGenerator
|
||||
{
|
||||
// Token: 0x0600809D RID: 32925 RVA: 0x001B2A6C File Offset: 0x001B0C6C
|
||||
[Token(Token = "0x600809D")]
|
||||
[Address(RVA = "0x3C3A30", Offset = "0x3C2430", VA = "0x1803C3A30")]
|
||||
public MiscPemGenerator(object obj)
|
||||
{
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
// Token: 0x0600809E RID: 32926 RVA: 0x001B2A88 File Offset: 0x001B0C88
|
||||
[Token(Token = "0x600809E")]
|
||||
[Address(RVA = "0x4DBC90", Offset = "0x4DA690", VA = "0x1804DBC90")]
|
||||
public MiscPemGenerator(object obj, string algorithm, char[] password, SecureRandom random)
|
||||
{
|
||||
int num = 0;
|
||||
base.FieldGetter(num, algorithm, password);
|
||||
this.obj = obj;
|
||||
this.password = password;
|
||||
this.random = 0;
|
||||
this.algorithm = algorithm;
|
||||
}
|
||||
|
||||
// Token: 0x0600809F RID: 32927 RVA: 0x001B2ABC File Offset: 0x001B0CBC
|
||||
[Token(Token = "0x600809F")]
|
||||
[Address(RVA = "0x4DAF10", Offset = "0x4D9910", VA = "0x1804DAF10")]
|
||||
private static PemObject CreatePemObject(object obj)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600809F)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem.PemObject BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl.MiscPemGenerator::CreatePemObject(System.Object)
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_74:
|
||||
stloc:string(var_13_83, call:string(Platform::GetTypeName, newobj:ArgumentNullException[exp:object](ArgumentNullException::.ctor, ldstr:string("obj"))))
|
||||
stloc:PemGenerationException(var_14_96, newobj:PemGenerationException(PemGenerationException::.ctor, call:string(string::Concat, ldstr:string("Object type not supported: "), ldloc:string(var_13_83))))
|
||||
}
|
||||
|
||||
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: 0x060080A0 RID: 32928 RVA: 0x001B2B60 File Offset: 0x001B0D60
|
||||
[Token(Token = "0x60080A0")]
|
||||
[Address(RVA = "0x4DAA80", Offset = "0x4D9480", VA = "0x1804DAA80")]
|
||||
private static PemObject CreatePemObject(object obj, string algorithm, char[] password, SecureRandom random)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (060080A0)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem.PemObject BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl.MiscPemGenerator::CreatePemObject(System.Object,System.String,System.Char[],BestHTTP.SecureProtocol.Org.BouncyCastle.Security.SecureRandom)
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_BC:
|
||||
stloc:string(var_14_CB, call:string(Platform::GetTypeName, newobj:ArgumentNullException[exp:object](ArgumentNullException::.ctor, ldstr:string("obj"))))
|
||||
stloc:PemGenerationException(var_15_DE, newobj:PemGenerationException(PemGenerationException::.ctor, call:string(string::Concat, ldstr:string("Object type not supported: "), ldloc:string(var_14_CB))))
|
||||
}
|
||||
|
||||
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: 0x060080A1 RID: 32929 RVA: 0x001B2C4C File Offset: 0x001B0E4C
|
||||
[Token(Token = "0x60080A1")]
|
||||
[Address(RVA = "0x4DB570", Offset = "0x4D9F70", VA = "0x1804DB570")]
|
||||
private static byte[] EncodePrivateKey(AsymmetricKeyParameter akp, out string keyType)
|
||||
{
|
||||
int num = 0;
|
||||
PrivateKeyInfo privateKeyInfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo(akp, num);
|
||||
TypeCode typeCode = privateKeyInfo.HasPublicKey.GetTypeCode();
|
||||
return privateKeyInfo.PrivateKeyAlgorithm.GetEncoded();
|
||||
}
|
||||
|
||||
// Token: 0x060080A2 RID: 32930 RVA: 0x001B2D74 File Offset: 0x001B0F74
|
||||
[Token(Token = "0x60080A2")]
|
||||
[Address(RVA = "0x4DBBE0", Offset = "0x4DA5E0", VA = "0x1804DBBE0", Slot = "4")]
|
||||
public PemObject Generate()
|
||||
{
|
||||
string text = this.algorithm;
|
||||
object obj = this.obj;
|
||||
if (text == 0)
|
||||
{
|
||||
PemObject pemObject = MiscPemGenerator.CreatePemObject(obj);
|
||||
}
|
||||
SecureRandom secureRandom = this.random;
|
||||
char[] array = this.password;
|
||||
return MiscPemGenerator.CreatePemObject(obj, text, array, secureRandom);
|
||||
}
|
||||
|
||||
// Token: 0x04005AF4 RID: 23284
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4005AF4")]
|
||||
private object obj;
|
||||
|
||||
// Token: 0x04005AF5 RID: 23285
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4005AF5")]
|
||||
private string algorithm;
|
||||
|
||||
// Token: 0x04005AF6 RID: 23286
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4005AF6")]
|
||||
private char[] password;
|
||||
|
||||
// Token: 0x04005AF7 RID: 23287
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x4005AF7")]
|
||||
private SecureRandom random;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x020013BA RID: 5050
|
||||
[Token(Token = "0x20013BA")]
|
||||
[Serializable]
|
||||
[StructLayout(3)]
|
||||
public class PemException : IOException
|
||||
{
|
||||
// Token: 0x060080A3 RID: 32931 RVA: 0x001B2DB8 File Offset: 0x001B0FB8
|
||||
[Token(Token = "0x60080A3")]
|
||||
[Address(RVA = "0x47A3A0", Offset = "0x478DA0", VA = "0x18047A3A0")]
|
||||
public PemException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060080A4 RID: 32932 RVA: 0x001B2DCC File Offset: 0x001B0FCC
|
||||
[Token(Token = "0x60080A4")]
|
||||
[Address(RVA = "0x47A3B0", Offset = "0x478DB0", VA = "0x18047A3B0")]
|
||||
public PemException(string message, Exception exception)
|
||||
: base(message, exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,372 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Sec;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X9;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Encoders;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x020013BB RID: 5051
|
||||
[Token(Token = "0x20013BB")]
|
||||
[StructLayout(3)]
|
||||
public class PemReader : PemReader
|
||||
{
|
||||
// Token: 0x060080A5 RID: 32933 RVA: 0x0000220F File Offset: 0x0000040F
|
||||
[Token(Token = "0x60080A5")]
|
||||
[Address(RVA = "0x3C9F60", Offset = "0x3C8960", VA = "0x1803C9F60")]
|
||||
static PemReader()
|
||||
{
|
||||
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
||||
}
|
||||
|
||||
// Token: 0x060080A6 RID: 32934 RVA: 0x001B2DE4 File Offset: 0x001B0FE4
|
||||
[Token(Token = "0x60080A6")]
|
||||
[Address(RVA = "0x4DD360", Offset = "0x4DBD60", VA = "0x1804DD360")]
|
||||
public PemReader(TextReader reader)
|
||||
: base(reader)
|
||||
{
|
||||
this.pFinder = (ulong)0L;
|
||||
}
|
||||
|
||||
// Token: 0x060080A7 RID: 32935 RVA: 0x001B2E04 File Offset: 0x001B1004
|
||||
[Token(Token = "0x60080A7")]
|
||||
[Address(RVA = "0x4DD330", Offset = "0x4DBD30", VA = "0x1804DD330")]
|
||||
public PemReader(TextReader reader, IPasswordFinder pFinder)
|
||||
: base(reader)
|
||||
{
|
||||
this.pFinder = pFinder;
|
||||
}
|
||||
|
||||
// Token: 0x060080A8 RID: 32936 RVA: 0x001B2E20 File Offset: 0x001B1020
|
||||
[Token(Token = "0x60080A8")]
|
||||
[Address(RVA = "0x4DC0E0", Offset = "0x4DAAE0", VA = "0x1804DC0E0")]
|
||||
public object ReadObject()
|
||||
{
|
||||
PemObject pemObject = base.ReadPemObject();
|
||||
if (pemObject != 0)
|
||||
{
|
||||
if (!Platform.EndsWith(pemObject.type, "PRIVATE KEY"))
|
||||
{
|
||||
string type = pemObject.type;
|
||||
uint num = <PrivateImplementationDetails>.ComputeStringHash(type);
|
||||
if (num > (uint)1592636440)
|
||||
{
|
||||
if (num > (uint)(-2093939407))
|
||||
{
|
||||
if (num == (uint)(-1925861857))
|
||||
{
|
||||
if (!string.Equals(type, "PUBLIC KEY"))
|
||||
{
|
||||
goto IL_186;
|
||||
}
|
||||
AsymmetricKeyParameter asymmetricKeyParameter = PublicKeyFactory.CreateKey(pemObject.content);
|
||||
}
|
||||
bool flag;
|
||||
if (num == (uint)(-1905462054))
|
||||
{
|
||||
flag = string.Equals(type, "CMS");
|
||||
if (!flag)
|
||||
{
|
||||
goto IL_186;
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
{
|
||||
goto IL_186;
|
||||
}
|
||||
if (string.Equals(type, "NEW CERTIFICATE REQUEST"))
|
||||
{
|
||||
goto IL_10C;
|
||||
}
|
||||
}
|
||||
if (num == (uint)1951606473)
|
||||
{
|
||||
if (!string.Equals(type, "RSA PUBLIC KEY"))
|
||||
{
|
||||
goto IL_186;
|
||||
}
|
||||
RsaPublicKeyStructure instance = RsaPublicKeyStructure.GetInstance(Asn1Object.FromByteArray(pemObject.content));
|
||||
BigInteger modulus = instance.modulus;
|
||||
BigInteger publicExponent = instance.publicExponent;
|
||||
int num2;
|
||||
RsaKeyParameters rsaKeyParameters = new RsaKeyParameters(num2 != 0, modulus, publicExponent);
|
||||
num2 = 0;
|
||||
}
|
||||
if (num != (uint)(-2093939407) || !string.Equals(type, "CERTIFICATE REQUEST"))
|
||||
{
|
||||
goto IL_186;
|
||||
}
|
||||
IL_10C:
|
||||
Pkcs10CertificationRequest pkcs10CertificationRequest = this.ReadCertificateRequest(pemObject);
|
||||
}
|
||||
if (num > (uint)479209360)
|
||||
{
|
||||
X509Crl x509Crl;
|
||||
if (num == (uint)1514293038)
|
||||
{
|
||||
if (!string.Equals(type, "X509 CRL"))
|
||||
{
|
||||
goto IL_186;
|
||||
}
|
||||
x509Crl = this.ReadCrl(pemObject);
|
||||
}
|
||||
BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.ContentInfo contentInfo;
|
||||
if ((x509Crl == (ulong)1517936775L && x509Crl == 0) || contentInfo != (ulong)1592636440L || contentInfo == 0)
|
||||
{
|
||||
goto IL_186;
|
||||
}
|
||||
}
|
||||
X509V2AttributeCertificate x509V2AttributeCertificate;
|
||||
if ((x509V2AttributeCertificate != (ulong)368575810L || x509V2AttributeCertificate == 0) && (x509V2AttributeCertificate != (ulong)479209360L || x509V2AttributeCertificate == 0))
|
||||
{
|
||||
goto IL_186;
|
||||
}
|
||||
}
|
||||
return this.ReadPrivateKey(pemObject);
|
||||
}
|
||||
IL_186:
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x060080A9 RID: 32937 RVA: 0x001B2FC4 File Offset: 0x001B11C4
|
||||
[Token(Token = "0x60080A9")]
|
||||
[Address(RVA = "0x4DD290", Offset = "0x4DBC90", VA = "0x1804DD290")]
|
||||
private AsymmetricKeyParameter ReadRsaPublicKey(PemObject pemObject)
|
||||
{
|
||||
RsaPublicKeyStructure instance = RsaPublicKeyStructure.GetInstance(Asn1Object.FromByteArray(pemObject.content));
|
||||
BigInteger publicExponent = instance.publicExponent;
|
||||
BigInteger modulus = instance.modulus;
|
||||
int num;
|
||||
RsaKeyParameters rsaKeyParameters = new RsaKeyParameters(num != 0, modulus, publicExponent);
|
||||
num = 0;
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x060080AA RID: 32938 RVA: 0x001B3004 File Offset: 0x001B1204
|
||||
[Token(Token = "0x60080AA")]
|
||||
[Address(RVA = "0x4DD260", Offset = "0x4DBC60", VA = "0x1804DD260")]
|
||||
private AsymmetricKeyParameter ReadPublicKey(PemObject pemObject)
|
||||
{
|
||||
return PublicKeyFactory.CreateKey(pemObject.content);
|
||||
}
|
||||
|
||||
// Token: 0x060080AB RID: 32939 RVA: 0x001B3024 File Offset: 0x001B1224
|
||||
[Token(Token = "0x60080AB")]
|
||||
[Address(RVA = "0x4DBF00", Offset = "0x4DA900", VA = "0x1804DBF00")]
|
||||
private X509Certificate ReadCertificate(PemObject pemObject)
|
||||
{
|
||||
X509CertificateParser x509CertificateParser = new X509CertificateParser();
|
||||
byte[] content = pemObject.content;
|
||||
return x509CertificateParser.ReadCertificate(content);
|
||||
}
|
||||
|
||||
// Token: 0x060080AC RID: 32940 RVA: 0x001B3060 File Offset: 0x001B1260
|
||||
[Token(Token = "0x60080AC")]
|
||||
[Address(RVA = "0x4DBFF0", Offset = "0x4DA9F0", VA = "0x1804DBFF0")]
|
||||
private X509Crl ReadCrl(PemObject pemObject)
|
||||
{
|
||||
X509CrlParser x509CrlParser = new X509CrlParser();
|
||||
byte[] content = pemObject.content;
|
||||
return x509CrlParser.ReadCrl(content);
|
||||
}
|
||||
|
||||
// Token: 0x060080AD RID: 32941 RVA: 0x001B309C File Offset: 0x001B129C
|
||||
[Token(Token = "0x60080AD")]
|
||||
[Address(RVA = "0x4DBE20", Offset = "0x4DA820", VA = "0x1804DBE20")]
|
||||
private Pkcs10CertificationRequest ReadCertificateRequest(PemObject pemObject)
|
||||
{
|
||||
return new Pkcs10CertificationRequest(pemObject.content);
|
||||
}
|
||||
|
||||
// Token: 0x060080AE RID: 32942 RVA: 0x001B30C8 File Offset: 0x001B12C8
|
||||
[Token(Token = "0x60080AE")]
|
||||
[Address(RVA = "0x4DBDB0", Offset = "0x4DA7B0", VA = "0x1804DBDB0")]
|
||||
private IX509AttributeCertificate ReadAttributeCertificate(PemObject pemObject)
|
||||
{
|
||||
X509V2AttributeCertificate x509V2AttributeCertificate = new X509V2AttributeCertificate(pemObject.content);
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x060080AF RID: 32943 RVA: 0x001B30E8 File Offset: 0x001B12E8
|
||||
[Token(Token = "0x60080AF")]
|
||||
[Address(RVA = "0x4DC4D0", Offset = "0x4DAED0", VA = "0x1804DC4D0")]
|
||||
private BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.ContentInfo ReadPkcs7(PemObject pemObject)
|
||||
{
|
||||
return BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.ContentInfo.GetInstance(Asn1Object.FromByteArray(pemObject.content));
|
||||
}
|
||||
|
||||
// Token: 0x060080B0 RID: 32944 RVA: 0x001B3118 File Offset: 0x001B1318
|
||||
[Token(Token = "0x60080B0")]
|
||||
[Address(RVA = "0x4DC5A0", Offset = "0x4DAFA0", VA = "0x1804DC5A0")]
|
||||
private object ReadPrivateKey(PemObject pemObject)
|
||||
{
|
||||
AsymmetricCipherKeyPair asymmetricCipherKeyPair;
|
||||
for (;;)
|
||||
{
|
||||
int num = 0;
|
||||
string type = pemObject.type;
|
||||
int stringLength = type.m_stringLength;
|
||||
int num2 = 0;
|
||||
string text = type.Substring(num2, stringLength).Trim();
|
||||
IDictionary dictionary = Platform.CreateHashtable();
|
||||
IList headers = pemObject.headers;
|
||||
if (dictionary != 0)
|
||||
{
|
||||
if (num < dictionary)
|
||||
{
|
||||
num += num;
|
||||
num++;
|
||||
}
|
||||
ulong num3;
|
||||
num3 += (ulong)1L;
|
||||
if (dictionary == 0)
|
||||
{
|
||||
goto IL_1F4;
|
||||
}
|
||||
if (num < dictionary)
|
||||
{
|
||||
num += num;
|
||||
num++;
|
||||
}
|
||||
num++;
|
||||
num += 19;
|
||||
}
|
||||
if (num != 0)
|
||||
{
|
||||
}
|
||||
if (num != -1)
|
||||
{
|
||||
}
|
||||
if (num == 0 && (num == 0 || num != 0))
|
||||
{
|
||||
int num4 = 0;
|
||||
if (num != 0)
|
||||
{
|
||||
if (num4 == 0 || num == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
uint num5;
|
||||
(new char[1])[0] = (char)num5;
|
||||
if (num == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
string[] array;
|
||||
string text2 = array[0].Trim();
|
||||
byte[] array2 = Hex.Decode(array[1].Trim());
|
||||
}
|
||||
byte[] array3;
|
||||
Asn1Sequence instance = Asn1Sequence.GetInstance(array3);
|
||||
if (instance != 0)
|
||||
{
|
||||
Asn1Encodable asn1Encodable;
|
||||
if (asn1Encodable != (ulong)9L)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
RsaPrivateKeyStructure instance2 = RsaPrivateKeyStructure.GetInstance(instance);
|
||||
BigInteger modulus = instance2.modulus;
|
||||
BigInteger publicExponent = instance2.publicExponent;
|
||||
int num6;
|
||||
RsaKeyParameters rsaKeyParameters = new RsaKeyParameters(num6 != 0, modulus, publicExponent);
|
||||
num6 = 0;
|
||||
BigInteger privateExponent = instance2.privateExponent;
|
||||
BigInteger prime = instance2.prime1;
|
||||
BigInteger coefficient = instance2.coefficient;
|
||||
}
|
||||
RsaPrivateCrtKeyParameters rsaPrivateCrtKeyParameters;
|
||||
if (rsaPrivateCrtKeyParameters != 0)
|
||||
{
|
||||
BigInteger bigInteger;
|
||||
BigInteger bigInteger2;
|
||||
BigInteger bigInteger3;
|
||||
DsaParameters dsaParameters = new DsaParameters(bigInteger, bigInteger2, bigInteger3);
|
||||
BigInteger bigInteger4;
|
||||
DsaPrivateKeyParameters dsaPrivateKeyParameters = new DsaPrivateKeyParameters(bigInteger4, dsaParameters);
|
||||
BigInteger bigInteger5;
|
||||
if (new DsaPublicKeyParameters(bigInteger5, dsaParameters) != 0)
|
||||
{
|
||||
ECPrivateKeyStructure instance3 = ECPrivateKeyStructure.GetInstance(dsaParameters);
|
||||
DerObjectIdentifier idECPublicKey = X9ObjectIdentifiers.IdECPublicKey;
|
||||
DerBitString publicKey = instance3.GetPublicKey();
|
||||
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(idECPublicKey, publicKey);
|
||||
Asn1Object asn1Object = instance3.ToAsn1Object();
|
||||
AsymmetricKeyParameter asymmetricKeyParameter = PrivateKeyFactory.CreateKey(new PrivateKeyInfo(algorithmIdentifier, asn1Object));
|
||||
if (instance3.GetKey() == 0)
|
||||
{
|
||||
}
|
||||
SubjectPublicKeyInfo subjectPublicKeyInfo;
|
||||
asymmetricCipherKeyPair = new AsymmetricCipherKeyPair(PublicKeyFactory.CreateKey(subjectPublicKeyInfo), asymmetricKeyParameter);
|
||||
}
|
||||
if (asymmetricCipherKeyPair == 0)
|
||||
{
|
||||
goto IL_1DA;
|
||||
}
|
||||
int sign = bigInteger.sign;
|
||||
if (asymmetricCipherKeyPair != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EncryptedPrivateKeyInfo instance4 = EncryptedPrivateKeyInfo.GetInstance(asymmetricCipherKeyPair);
|
||||
IL_1DA:
|
||||
AsymmetricKeyParameter asymmetricKeyParameter3;
|
||||
AsymmetricKeyParameter asymmetricKeyParameter2 = PrivateKeyFactory.CreateKey(PrivateKeyInfo.GetInstance(asymmetricKeyParameter3));
|
||||
throw new NullReferenceException();
|
||||
IL_1F4:
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x060080B1 RID: 32945 RVA: 0x001B3324 File Offset: 0x001B1524
|
||||
[Token(Token = "0x60080B1")]
|
||||
[Address(RVA = "0x4DBCF0", Offset = "0x4DA6F0", VA = "0x1804DBCF0")]
|
||||
private static X9ECParameters GetCurveParameters(string name)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (060080B1)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X9.X9ECParameters BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl.PemReader::GetCurveParameters(System.String)
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_16:
|
||||
stloc:Exception(var_1_26, newobj:Exception(Exception::.ctor, call:string(string::Concat, ldstr:string("unknown curve name: "), ldloc:string(name))))
|
||||
}
|
||||
|
||||
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: 0x04005AF8 RID: 23288
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4005AF8")]
|
||||
private readonly IPasswordFinder pFinder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x020013BC RID: 5052
|
||||
[Token(Token = "0x20013BC")]
|
||||
[StructLayout(3)]
|
||||
internal sealed class PemUtilities
|
||||
{
|
||||
// Token: 0x060080B2 RID: 32946 RVA: 0x001B3358 File Offset: 0x001B1558
|
||||
[Token(Token = "0x60080B2")]
|
||||
[Address(RVA = "0x4DDDA0", Offset = "0x4DC7A0", VA = "0x1804DDDA0")]
|
||||
static PemUtilities()
|
||||
{
|
||||
Enum arbitraryValue = Enums.GetArbitraryValue(typeof(PemUtilities.PemBaseAlg));
|
||||
Enum arbitraryValue2 = Enums.GetArbitraryValue(typeof(PemUtilities.PemMode));
|
||||
}
|
||||
|
||||
// Token: 0x060080B3 RID: 32947 RVA: 0x001B33A0 File Offset: 0x001B15A0
|
||||
[Token(Token = "0x60080B3")]
|
||||
[Address(RVA = "0x4DDB20", Offset = "0x4DC520", VA = "0x1804DDB20")]
|
||||
private static void ParseDekAlgName(string dekAlgName, out PemUtilities.PemBaseAlg baseAlg, out PemUtilities.PemMode mode)
|
||||
{
|
||||
Type typeFromHandle = typeof(PemUtilities.PemBaseAlg);
|
||||
int num = 0;
|
||||
int num2;
|
||||
string text = dekAlgName.Substring(num, num2);
|
||||
Enum enumValue = Enums.GetEnumValue(typeFromHandle, text);
|
||||
baseAlg.value__ = enumValue;
|
||||
Type typeFromHandle2 = typeof(PemUtilities.PemMode);
|
||||
int num3 = num2 + 1;
|
||||
string text2 = dekAlgName.Substring(num3);
|
||||
Enum enumValue2 = Enums.GetEnumValue(typeFromHandle2, text2);
|
||||
mode.value__ = enumValue2;
|
||||
Enum enumValue3 = Enums.GetEnumValue(typeof(PemUtilities.PemBaseAlg), dekAlgName);
|
||||
baseAlg.value__ = enumValue3;
|
||||
}
|
||||
|
||||
// Token: 0x060080B4 RID: 32948 RVA: 0x001B3448 File Offset: 0x001B1648
|
||||
[Token(Token = "0x60080B4")]
|
||||
[Address(RVA = "0x4DD380", Offset = "0x4DBD80", VA = "0x1804DD380")]
|
||||
internal static byte[] Crypt(bool encrypt, byte[] bytes, char[] password, string dekAlgName, byte[] iv)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (060080B4)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl.PemUtilities::Crypt(System.Boolean,System.Byte[],System.Char[],System.String,System.Byte[])
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_B6:
|
||||
stloc:EncryptionException(var_15_C7, newobj:EncryptionException(EncryptionException::.ctor, call:string(string::Concat, ldstr:string("Unknown DEK algorithm: "), ldloc:string(var_13))))
|
||||
}
|
||||
|
||||
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: 0x060080B5 RID: 32949 RVA: 0x001B3520 File Offset: 0x001B1720
|
||||
[Token(Token = "0x60080B5")]
|
||||
[Address(RVA = "0x4DD990", Offset = "0x4DC390", VA = "0x1804DD990")]
|
||||
private static ICipherParameters GetCipherParameters(char[] password, PemUtilities.PemBaseAlg baseAlg, byte[] salt)
|
||||
{
|
||||
if (baseAlg <= PemUtilities.PemBaseAlg.RC2_64)
|
||||
{
|
||||
OpenSslPbeParametersGenerator openSslPbeParametersGenerator = new OpenSslPbeParametersGenerator();
|
||||
byte[] array = PbeParametersGenerator.Pkcs5PasswordToBytes(password);
|
||||
ICipherParameters cipherParameters;
|
||||
return cipherParameters;
|
||||
}
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x060080B6 RID: 32950 RVA: 0x001B3548 File Offset: 0x001B1748
|
||||
[Token(Token = "0x60080B6")]
|
||||
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
||||
public PemUtilities()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x020013BD RID: 5053
|
||||
[Token(Token = "0x20013BD")]
|
||||
private enum PemBaseAlg
|
||||
{
|
||||
// Token: 0x04005AFA RID: 23290
|
||||
[Token(Token = "0x4005AFA")]
|
||||
AES_128,
|
||||
// Token: 0x04005AFB RID: 23291
|
||||
[Token(Token = "0x4005AFB")]
|
||||
AES_192,
|
||||
// Token: 0x04005AFC RID: 23292
|
||||
[Token(Token = "0x4005AFC")]
|
||||
AES_256,
|
||||
// Token: 0x04005AFD RID: 23293
|
||||
[Token(Token = "0x4005AFD")]
|
||||
BF,
|
||||
// Token: 0x04005AFE RID: 23294
|
||||
[Token(Token = "0x4005AFE")]
|
||||
DES,
|
||||
// Token: 0x04005AFF RID: 23295
|
||||
[Token(Token = "0x4005AFF")]
|
||||
DES_EDE,
|
||||
// Token: 0x04005B00 RID: 23296
|
||||
[Token(Token = "0x4005B00")]
|
||||
DES_EDE3,
|
||||
// Token: 0x04005B01 RID: 23297
|
||||
[Token(Token = "0x4005B01")]
|
||||
RC2,
|
||||
// Token: 0x04005B02 RID: 23298
|
||||
[Token(Token = "0x4005B02")]
|
||||
RC2_40,
|
||||
// Token: 0x04005B03 RID: 23299
|
||||
[Token(Token = "0x4005B03")]
|
||||
RC2_64
|
||||
}
|
||||
|
||||
// Token: 0x020013BE RID: 5054
|
||||
[Token(Token = "0x20013BE")]
|
||||
private enum PemMode
|
||||
{
|
||||
// Token: 0x04005B05 RID: 23301
|
||||
[Token(Token = "0x4005B05")]
|
||||
CBC,
|
||||
// Token: 0x04005B06 RID: 23302
|
||||
[Token(Token = "0x4005B06")]
|
||||
CFB,
|
||||
// Token: 0x04005B07 RID: 23303
|
||||
[Token(Token = "0x4005B07")]
|
||||
ECB,
|
||||
// Token: 0x04005B08 RID: 23304
|
||||
[Token(Token = "0x4005B08")]
|
||||
OFB
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x020013BF RID: 5055
|
||||
[Token(Token = "0x20013BF")]
|
||||
[StructLayout(3)]
|
||||
public class PemWriter : PemWriter
|
||||
{
|
||||
// Token: 0x060080B7 RID: 32951 RVA: 0x001B355C File Offset: 0x001B175C
|
||||
[Token(Token = "0x60080B7")]
|
||||
[Address(RVA = "0x4DE0A0", Offset = "0x4DCAA0", VA = "0x1804DE0A0")]
|
||||
public PemWriter(TextWriter writer)
|
||||
: base(writer)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060080B8 RID: 32952 RVA: 0x001B3570 File Offset: 0x001B1770
|
||||
[Token(Token = "0x60080B8")]
|
||||
[Address(RVA = "0x4DDF10", Offset = "0x4DC910", VA = "0x1804DDF10")]
|
||||
public void WriteObject(object obj)
|
||||
{
|
||||
MiscPemGenerator miscPemGenerator;
|
||||
miscPemGenerator.obj = obj;
|
||||
base.WriteObject(miscPemGenerator);
|
||||
}
|
||||
|
||||
// Token: 0x060080B9 RID: 32953 RVA: 0x001B358C File Offset: 0x001B178C
|
||||
[Token(Token = "0x60080B9")]
|
||||
[Address(RVA = "0x4DE000", Offset = "0x4DCA00", VA = "0x1804DE000")]
|
||||
public void WriteObject(object obj, string algorithm, char[] password, SecureRandom random)
|
||||
{
|
||||
int num = 0;
|
||||
MiscPemGenerator miscPemGenerator;
|
||||
miscPemGenerator.FieldGetter(num, algorithm, password);
|
||||
miscPemGenerator.random = 0;
|
||||
miscPemGenerator.obj = obj;
|
||||
miscPemGenerator.algorithm = algorithm;
|
||||
miscPemGenerator.password = password;
|
||||
base.WriteObject(miscPemGenerator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x020013C0 RID: 5056
|
||||
[Token(Token = "0x20013C0")]
|
||||
[StructLayout(3)]
|
||||
public class Pkcs8Generator : PemObjectGenerator
|
||||
{
|
||||
// Token: 0x060080BA RID: 32954 RVA: 0x001B35C8 File Offset: 0x001B17C8
|
||||
[Token(Token = "0x60080BA")]
|
||||
[Address(RVA = "0x4E90C0", Offset = "0x4E7AC0", VA = "0x1804E90C0")]
|
||||
public Pkcs8Generator(AsymmetricKeyParameter privKey)
|
||||
{
|
||||
this.privKey = privKey;
|
||||
}
|
||||
|
||||
// Token: 0x060080BB RID: 32955 RVA: 0x001B35E4 File Offset: 0x001B17E4
|
||||
[Token(Token = "0x60080BB")]
|
||||
[Address(RVA = "0x4E9080", Offset = "0x4E7A80", VA = "0x1804E9080")]
|
||||
public Pkcs8Generator(AsymmetricKeyParameter privKey, string algorithm)
|
||||
{
|
||||
this.privKey = privKey;
|
||||
this.algorithm = algorithm;
|
||||
this.iterationCount = (int)((ulong)2048L);
|
||||
}
|
||||
|
||||
// Token: 0x17001500 RID: 5376
|
||||
// (set) Token: 0x060080BC RID: 32956 RVA: 0x001B3614 File Offset: 0x001B1814
|
||||
[Token(Token = "0x17001500")]
|
||||
public SecureRandom SecureRandom
|
||||
{
|
||||
[Token(Token = "0x60080BC")]
|
||||
[Address(RVA = "0x3C1290", Offset = "0x3BFC90", VA = "0x1803C1290")]
|
||||
set
|
||||
{
|
||||
this.random = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17001501 RID: 5377
|
||||
// (set) Token: 0x060080BD RID: 32957 RVA: 0x001B3628 File Offset: 0x001B1828
|
||||
[Token(Token = "0x17001501")]
|
||||
public char[] Password
|
||||
{
|
||||
[Token(Token = "0x60080BD")]
|
||||
[Address(RVA = "0x3C39B0", Offset = "0x3C23B0", VA = "0x1803C39B0")]
|
||||
set
|
||||
{
|
||||
this.password = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17001502 RID: 5378
|
||||
// (set) Token: 0x060080BE RID: 32958 RVA: 0x001B363C File Offset: 0x001B183C
|
||||
[Token(Token = "0x17001502")]
|
||||
public int IterationCount
|
||||
{
|
||||
[Token(Token = "0x60080BE")]
|
||||
[Address(RVA = "0x4E90F0", Offset = "0x4E7AF0", VA = "0x1804E90F0")]
|
||||
set
|
||||
{
|
||||
this.iterationCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060080BF RID: 32959 RVA: 0x001B3650 File Offset: 0x001B1850
|
||||
[Token(Token = "0x60080BF")]
|
||||
[Address(RVA = "0x4E8D30", Offset = "0x4E7730", VA = "0x1804E8D30", Slot = "4")]
|
||||
public PemObject Generate()
|
||||
{
|
||||
if (this.PbeSha1_2DES != (ulong)0L)
|
||||
{
|
||||
byte[] array = new byte[20];
|
||||
SecureRandom secureRandom = this.random;
|
||||
if (secureRandom == 0)
|
||||
{
|
||||
SecureRandom secureRandom2 = new SecureRandom();
|
||||
this.random = secureRandom2;
|
||||
}
|
||||
double num = secureRandom.NextDouble();
|
||||
string text = this.algorithm;
|
||||
char[] array2 = this.password;
|
||||
int num2 = this.iterationCount;
|
||||
int num3 = 0;
|
||||
PrivateKeyInfo privateKeyInfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo(this.privKey, num3);
|
||||
byte[] encoded = EncryptedPrivateKeyInfoFactory.CreateEncryptedPrivateKeyInfo(text, array2, array, num2, privateKeyInfo).GetEncoded();
|
||||
return new PemObject("ENCRYPTED PRIVATE KEY", encoded);
|
||||
}
|
||||
int num4 = 0;
|
||||
byte[] encoded2 = PrivateKeyInfoFactory.CreatePrivateKeyInfo(this.privKey, num4).GetEncoded();
|
||||
PemObject pemObject = new PemObject("PRIVATE KEY", encoded2);
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x04005B09 RID: 23305
|
||||
[Token(Token = "0x4005B09")]
|
||||
public static readonly string PbeSha1_RC4_128 = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC4.identifier;
|
||||
|
||||
// Token: 0x04005B0A RID: 23306
|
||||
[Token(Token = "0x4005B0A")]
|
||||
public static readonly string PbeSha1_RC4_40 = PkcsObjectIdentifiers.PbeWithShaAnd40BitRC4.identifier;
|
||||
|
||||
// Token: 0x04005B0B RID: 23307
|
||||
[Token(Token = "0x4005B0B")]
|
||||
public static readonly string PbeSha1_3DES = PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc.identifier;
|
||||
|
||||
// Token: 0x04005B0C RID: 23308
|
||||
[Token(Token = "0x4005B0C")]
|
||||
public static readonly string PbeSha1_2DES = PkcsObjectIdentifiers.PbeWithShaAnd2KeyTripleDesCbc.identifier;
|
||||
|
||||
// Token: 0x04005B0D RID: 23309
|
||||
[Token(Token = "0x4005B0D")]
|
||||
public static readonly string PbeSha1_RC2_128 = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC2Cbc.identifier;
|
||||
|
||||
// Token: 0x04005B0E RID: 23310
|
||||
[Token(Token = "0x4005B0E")]
|
||||
public static readonly string PbeSha1_RC2_40 = PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc.identifier;
|
||||
|
||||
// Token: 0x04005B0F RID: 23311
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4005B0F")]
|
||||
private char[] password;
|
||||
|
||||
// Token: 0x04005B10 RID: 23312
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4005B10")]
|
||||
private string algorithm;
|
||||
|
||||
// Token: 0x04005B11 RID: 23313
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4005B11")]
|
||||
private int iterationCount;
|
||||
|
||||
// Token: 0x04005B12 RID: 23314
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x4005B12")]
|
||||
private AsymmetricKeyParameter privKey;
|
||||
|
||||
// Token: 0x04005B13 RID: 23315
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x4005B13")]
|
||||
private SecureRandom random;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user