a
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x02001995 RID: 6549
|
||||
[Token(Token = "0x2001995")]
|
||||
public interface IPasswordFinder
|
||||
{
|
||||
// Token: 0x06009C76 RID: 40054
|
||||
[Token(Token = "0x6009C76")]
|
||||
[Address(Slot = "0")]
|
||||
char[] GetPassword();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
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: 0x02001996 RID: 6550
|
||||
[Token(Token = "0x2001996")]
|
||||
public class MiscPemGenerator : PemObjectGenerator
|
||||
{
|
||||
// Token: 0x06009C77 RID: 40055 RVA: 0x00209CEC File Offset: 0x00207EEC
|
||||
[Token(Token = "0x6009C77")]
|
||||
[Address(RVA = "0x3FFB80", Offset = "0x3FE980", VA = "0x1803FFB80")]
|
||||
public MiscPemGenerator(object obj)
|
||||
{
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
// Token: 0x06009C78 RID: 40056 RVA: 0x00209D08 File Offset: 0x00207F08
|
||||
[Token(Token = "0x6009C78")]
|
||||
[Address(RVA = "0xBD6F30", Offset = "0xBD5D30", VA = "0x180BD6F30")]
|
||||
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: 0x06009C79 RID: 40057 RVA: 0x00209D3C File Offset: 0x00207F3C
|
||||
[Token(Token = "0x6009C79")]
|
||||
[Address(RVA = "0x28B5DC0", Offset = "0x28B4BC0", VA = "0x1828B5DC0")]
|
||||
private static PemObject CreatePemObject(object obj)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (06009C79)
|
||||
|
||||
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 1660
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x06009C7A RID: 40058 RVA: 0x00209DE0 File Offset: 0x00207FE0
|
||||
[Token(Token = "0x6009C7A")]
|
||||
[Address(RVA = "0x28B5930", Offset = "0x28B4730", VA = "0x1828B5930")]
|
||||
private static PemObject CreatePemObject(object obj, string algorithm, char[] password, SecureRandom random)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (06009C7A)
|
||||
|
||||
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 1660
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x06009C7B RID: 40059 RVA: 0x00209ECC File Offset: 0x002080CC
|
||||
[Token(Token = "0x6009C7B")]
|
||||
[Address(RVA = "0x28B6420", Offset = "0x28B5220", VA = "0x1828B6420")]
|
||||
private static byte[] EncodePrivateKey(AsymmetricKeyParameter akp, out string keyType)
|
||||
{
|
||||
PrivateKeyInfo privateKeyInfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo(akp);
|
||||
TypeCode typeCode = privateKeyInfo.HasPublicKey.GetTypeCode();
|
||||
return privateKeyInfo.PrivateKeyAlgorithm.GetEncoded();
|
||||
}
|
||||
|
||||
// Token: 0x06009C7C RID: 40060 RVA: 0x00209FEC File Offset: 0x002081EC
|
||||
[Token(Token = "0x6009C7C")]
|
||||
[Address(RVA = "0x28B6A90", Offset = "0x28B5890", VA = "0x1828B6A90", 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: 0x04006937 RID: 26935
|
||||
[FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4006937")]
|
||||
private object obj;
|
||||
|
||||
// Token: 0x04006938 RID: 26936
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4006938")]
|
||||
private string algorithm;
|
||||
|
||||
// Token: 0x04006939 RID: 26937
|
||||
[FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4006939")]
|
||||
private char[] password;
|
||||
|
||||
// Token: 0x0400693A RID: 26938
|
||||
[FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x400693A")]
|
||||
private SecureRandom random;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x02001997 RID: 6551
|
||||
[Token(Token = "0x2001997")]
|
||||
[Serializable]
|
||||
public class PemException : IOException
|
||||
{
|
||||
// Token: 0x06009C7D RID: 40061 RVA: 0x0020A030 File Offset: 0x00208230
|
||||
[Token(Token = "0x6009C7D")]
|
||||
[Address(RVA = "0x424140", Offset = "0x422F40", VA = "0x180424140")]
|
||||
public PemException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06009C7E RID: 40062 RVA: 0x0020A044 File Offset: 0x00208244
|
||||
[Token(Token = "0x6009C7E")]
|
||||
[Address(RVA = "0x18E71C0", Offset = "0x18E5FC0", VA = "0x1818E71C0")]
|
||||
public PemException(string message, Exception exception)
|
||||
: base(message, exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,367 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
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: 0x02001998 RID: 6552
|
||||
[Token(Token = "0x2001998")]
|
||||
public class PemReader : PemReader
|
||||
{
|
||||
// Token: 0x06009C7F RID: 40063 RVA: 0x0000220F File Offset: 0x0000040F
|
||||
[Token(Token = "0x6009C7F")]
|
||||
[Address(RVA = "0x402080", Offset = "0x400E80", VA = "0x180402080")]
|
||||
static PemReader()
|
||||
{
|
||||
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
||||
}
|
||||
|
||||
// Token: 0x06009C80 RID: 40064 RVA: 0x0020A05C File Offset: 0x0020825C
|
||||
[Token(Token = "0x6009C80")]
|
||||
[Address(RVA = "0x28CA350", Offset = "0x28C9150", VA = "0x1828CA350")]
|
||||
public PemReader(TextReader reader)
|
||||
: base(reader)
|
||||
{
|
||||
this.pFinder = (ulong)0L;
|
||||
}
|
||||
|
||||
// Token: 0x06009C81 RID: 40065 RVA: 0x0020A07C File Offset: 0x0020827C
|
||||
[Token(Token = "0x6009C81")]
|
||||
[Address(RVA = "0x28CA320", Offset = "0x28C9120", VA = "0x1828CA320")]
|
||||
public PemReader(TextReader reader, IPasswordFinder pFinder)
|
||||
: base(reader)
|
||||
{
|
||||
this.pFinder = pFinder;
|
||||
}
|
||||
|
||||
// Token: 0x06009C82 RID: 40066 RVA: 0x0020A098 File Offset: 0x00208298
|
||||
[Token(Token = "0x6009C82")]
|
||||
[Address(RVA = "0x28C90F0", Offset = "0x28C7EF0", VA = "0x1828C90F0")]
|
||||
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: 0x06009C83 RID: 40067 RVA: 0x0020A23C File Offset: 0x0020843C
|
||||
[Token(Token = "0x6009C83")]
|
||||
[Address(RVA = "0x28CA280", Offset = "0x28C9080", VA = "0x1828CA280")]
|
||||
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: 0x06009C84 RID: 40068 RVA: 0x0020A27C File Offset: 0x0020847C
|
||||
[Token(Token = "0x6009C84")]
|
||||
[Address(RVA = "0x28CA250", Offset = "0x28C9050", VA = "0x1828CA250")]
|
||||
private AsymmetricKeyParameter ReadPublicKey(PemObject pemObject)
|
||||
{
|
||||
return PublicKeyFactory.CreateKey(pemObject.content);
|
||||
}
|
||||
|
||||
// Token: 0x06009C85 RID: 40069 RVA: 0x0020A29C File Offset: 0x0020849C
|
||||
[Token(Token = "0x6009C85")]
|
||||
[Address(RVA = "0x28C8F10", Offset = "0x28C7D10", VA = "0x1828C8F10")]
|
||||
private X509Certificate ReadCertificate(PemObject pemObject)
|
||||
{
|
||||
X509CertificateParser x509CertificateParser = new X509CertificateParser();
|
||||
byte[] content = pemObject.content;
|
||||
return x509CertificateParser.ReadCertificate(content);
|
||||
}
|
||||
|
||||
// Token: 0x06009C86 RID: 40070 RVA: 0x0020A2D8 File Offset: 0x002084D8
|
||||
[Token(Token = "0x6009C86")]
|
||||
[Address(RVA = "0x28C9000", Offset = "0x28C7E00", VA = "0x1828C9000")]
|
||||
private X509Crl ReadCrl(PemObject pemObject)
|
||||
{
|
||||
X509CrlParser x509CrlParser = new X509CrlParser();
|
||||
byte[] content = pemObject.content;
|
||||
return x509CrlParser.ReadCrl(content);
|
||||
}
|
||||
|
||||
// Token: 0x06009C87 RID: 40071 RVA: 0x0020A314 File Offset: 0x00208514
|
||||
[Token(Token = "0x6009C87")]
|
||||
[Address(RVA = "0x28C8E30", Offset = "0x28C7C30", VA = "0x1828C8E30")]
|
||||
private Pkcs10CertificationRequest ReadCertificateRequest(PemObject pemObject)
|
||||
{
|
||||
return new Pkcs10CertificationRequest(pemObject.content);
|
||||
}
|
||||
|
||||
// Token: 0x06009C88 RID: 40072 RVA: 0x0020A340 File Offset: 0x00208540
|
||||
[Token(Token = "0x6009C88")]
|
||||
[Address(RVA = "0x28C8DC0", Offset = "0x28C7BC0", VA = "0x1828C8DC0")]
|
||||
private IX509AttributeCertificate ReadAttributeCertificate(PemObject pemObject)
|
||||
{
|
||||
X509V2AttributeCertificate x509V2AttributeCertificate = new X509V2AttributeCertificate(pemObject.content);
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x06009C89 RID: 40073 RVA: 0x0020A360 File Offset: 0x00208560
|
||||
[Token(Token = "0x6009C89")]
|
||||
[Address(RVA = "0x28C94E0", Offset = "0x28C82E0", VA = "0x1828C94E0")]
|
||||
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: 0x06009C8A RID: 40074 RVA: 0x0020A390 File Offset: 0x00208590
|
||||
[Token(Token = "0x6009C8A")]
|
||||
[Address(RVA = "0x28C95B0", Offset = "0x28C83B0", VA = "0x1828C95B0")]
|
||||
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_1F0;
|
||||
}
|
||||
if (num < dictionary)
|
||||
{
|
||||
num += num;
|
||||
num++;
|
||||
}
|
||||
num++;
|
||||
num += 19;
|
||||
}
|
||||
if (num != 0)
|
||||
{
|
||||
}
|
||||
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_1D6;
|
||||
}
|
||||
int sign = bigInteger.sign;
|
||||
if (asymmetricCipherKeyPair != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EncryptedPrivateKeyInfo instance4 = EncryptedPrivateKeyInfo.GetInstance(asymmetricCipherKeyPair);
|
||||
IL_1D6:
|
||||
AsymmetricKeyParameter asymmetricKeyParameter3;
|
||||
AsymmetricKeyParameter asymmetricKeyParameter2 = PrivateKeyFactory.CreateKey(PrivateKeyInfo.GetInstance(asymmetricKeyParameter3));
|
||||
throw new NullReferenceException();
|
||||
IL_1F0:
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x06009C8B RID: 40075 RVA: 0x0020A598 File Offset: 0x00208798
|
||||
[Token(Token = "0x6009C8B")]
|
||||
[Address(RVA = "0x28C8D00", Offset = "0x28C7B00", VA = "0x1828C8D00")]
|
||||
private static X9ECParameters GetCurveParameters(string name)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (06009C8B)
|
||||
|
||||
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 1660
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x0400693B RID: 26939
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x400693B")]
|
||||
private readonly IPasswordFinder pFinder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
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: 0x02001999 RID: 6553
|
||||
[Token(Token = "0x2001999")]
|
||||
internal sealed class PemUtilities
|
||||
{
|
||||
// Token: 0x06009C8C RID: 40076 RVA: 0x0020A5CC File Offset: 0x002087CC
|
||||
[Token(Token = "0x6009C8C")]
|
||||
[Address(RVA = "0x1CBD350", Offset = "0x1CBC150", VA = "0x181CBD350")]
|
||||
static PemUtilities()
|
||||
{
|
||||
Enum arbitraryValue = Enums.GetArbitraryValue(typeof(PemUtilities.PemBaseAlg));
|
||||
Enum arbitraryValue2 = Enums.GetArbitraryValue(typeof(PemUtilities.PemMode));
|
||||
}
|
||||
|
||||
// Token: 0x06009C8D RID: 40077 RVA: 0x0020A614 File Offset: 0x00208814
|
||||
[Token(Token = "0x6009C8D")]
|
||||
[Address(RVA = "0x1CBD0D0", Offset = "0x1CBBED0", VA = "0x181CBD0D0")]
|
||||
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: 0x06009C8E RID: 40078 RVA: 0x0020A6BC File Offset: 0x002088BC
|
||||
[Token(Token = "0x6009C8E")]
|
||||
[Address(RVA = "0x1CBC930", Offset = "0x1CBB730", VA = "0x181CBC930")]
|
||||
internal static byte[] Crypt(bool encrypt, byte[] bytes, char[] password, string dekAlgName, byte[] iv)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (06009C8E)
|
||||
|
||||
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 1660
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x06009C8F RID: 40079 RVA: 0x0020A794 File Offset: 0x00208994
|
||||
[Token(Token = "0x6009C8F")]
|
||||
[Address(RVA = "0x1CBCF40", Offset = "0x1CBBD40", VA = "0x181CBCF40")]
|
||||
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: 0x06009C90 RID: 40080 RVA: 0x0020A7BC File Offset: 0x002089BC
|
||||
[Token(Token = "0x6009C90")]
|
||||
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
||||
public PemUtilities()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0200199A RID: 6554
|
||||
[Token(Token = "0x200199A")]
|
||||
private enum PemBaseAlg
|
||||
{
|
||||
// Token: 0x0400693D RID: 26941
|
||||
[Token(Token = "0x400693D")]
|
||||
AES_128,
|
||||
// Token: 0x0400693E RID: 26942
|
||||
[Token(Token = "0x400693E")]
|
||||
AES_192,
|
||||
// Token: 0x0400693F RID: 26943
|
||||
[Token(Token = "0x400693F")]
|
||||
AES_256,
|
||||
// Token: 0x04006940 RID: 26944
|
||||
[Token(Token = "0x4006940")]
|
||||
BF,
|
||||
// Token: 0x04006941 RID: 26945
|
||||
[Token(Token = "0x4006941")]
|
||||
DES,
|
||||
// Token: 0x04006942 RID: 26946
|
||||
[Token(Token = "0x4006942")]
|
||||
DES_EDE,
|
||||
// Token: 0x04006943 RID: 26947
|
||||
[Token(Token = "0x4006943")]
|
||||
DES_EDE3,
|
||||
// Token: 0x04006944 RID: 26948
|
||||
[Token(Token = "0x4006944")]
|
||||
RC2,
|
||||
// Token: 0x04006945 RID: 26949
|
||||
[Token(Token = "0x4006945")]
|
||||
RC2_40,
|
||||
// Token: 0x04006946 RID: 26950
|
||||
[Token(Token = "0x4006946")]
|
||||
RC2_64
|
||||
}
|
||||
|
||||
// Token: 0x0200199B RID: 6555
|
||||
[Token(Token = "0x200199B")]
|
||||
private enum PemMode
|
||||
{
|
||||
// Token: 0x04006948 RID: 26952
|
||||
[Token(Token = "0x4006948")]
|
||||
CBC,
|
||||
// Token: 0x04006949 RID: 26953
|
||||
[Token(Token = "0x4006949")]
|
||||
CFB,
|
||||
// Token: 0x0400694A RID: 26954
|
||||
[Token(Token = "0x400694A")]
|
||||
ECB,
|
||||
// Token: 0x0400694B RID: 26955
|
||||
[Token(Token = "0x400694B")]
|
||||
OFB
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO.Pem;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x0200199C RID: 6556
|
||||
[Token(Token = "0x200199C")]
|
||||
public class PemWriter : PemWriter
|
||||
{
|
||||
// Token: 0x06009C91 RID: 40081 RVA: 0x0020A7D0 File Offset: 0x002089D0
|
||||
[Token(Token = "0x6009C91")]
|
||||
[Address(RVA = "0x1CBD650", Offset = "0x1CBC450", VA = "0x181CBD650")]
|
||||
public PemWriter(TextWriter writer)
|
||||
: base(writer)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06009C92 RID: 40082 RVA: 0x0020A7E4 File Offset: 0x002089E4
|
||||
[Token(Token = "0x6009C92")]
|
||||
[Address(RVA = "0x1CBD4C0", Offset = "0x1CBC2C0", VA = "0x181CBD4C0")]
|
||||
public void WriteObject(object obj)
|
||||
{
|
||||
MiscPemGenerator miscPemGenerator = new MiscPemGenerator(obj);
|
||||
base.WriteObject(miscPemGenerator);
|
||||
}
|
||||
|
||||
// Token: 0x06009C93 RID: 40083 RVA: 0x0020A800 File Offset: 0x00208A00
|
||||
[Token(Token = "0x6009C93")]
|
||||
[Address(RVA = "0x1CBD5B0", Offset = "0x1CBC3B0", VA = "0x181CBD5B0")]
|
||||
public void WriteObject(object obj, string algorithm, char[] password, SecureRandom random)
|
||||
{
|
||||
MiscPemGenerator miscPemGenerator;
|
||||
base.WriteObject(miscPemGenerator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
using System;
|
||||
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: 0x0200199D RID: 6557
|
||||
[Token(Token = "0x200199D")]
|
||||
public class Pkcs8Generator : PemObjectGenerator
|
||||
{
|
||||
// Token: 0x06009C94 RID: 40084 RVA: 0x0020A814 File Offset: 0x00208A14
|
||||
[Token(Token = "0x6009C94")]
|
||||
[Address(RVA = "0x899650", Offset = "0x898450", VA = "0x180899650")]
|
||||
public Pkcs8Generator(AsymmetricKeyParameter privKey)
|
||||
{
|
||||
this.privKey = privKey;
|
||||
}
|
||||
|
||||
// Token: 0x06009C95 RID: 40085 RVA: 0x0020A830 File Offset: 0x00208A30
|
||||
[Token(Token = "0x6009C95")]
|
||||
[Address(RVA = "0x1CC84A0", Offset = "0x1CC72A0", VA = "0x181CC84A0")]
|
||||
public Pkcs8Generator(AsymmetricKeyParameter privKey, string algorithm)
|
||||
{
|
||||
this.privKey = privKey;
|
||||
this.algorithm = algorithm;
|
||||
this.iterationCount = (int)((ulong)2048L);
|
||||
}
|
||||
|
||||
// Token: 0x17001901 RID: 6401
|
||||
// (set) Token: 0x06009C96 RID: 40086 RVA: 0x0020A860 File Offset: 0x00208A60
|
||||
[Token(Token = "0x17001901")]
|
||||
public SecureRandom SecureRandom
|
||||
{
|
||||
[Token(Token = "0x6009C96")]
|
||||
[Address(RVA = "0x4437E0", Offset = "0x4425E0", VA = "0x1804437E0")]
|
||||
set
|
||||
{
|
||||
this.random = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17001902 RID: 6402
|
||||
// (set) Token: 0x06009C97 RID: 40087 RVA: 0x0020A874 File Offset: 0x00208A74
|
||||
[Token(Token = "0x17001902")]
|
||||
public char[] Password
|
||||
{
|
||||
[Token(Token = "0x6009C97")]
|
||||
[Address(RVA = "0x3F7200", Offset = "0x3F6000", VA = "0x1803F7200")]
|
||||
set
|
||||
{
|
||||
this.password = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17001903 RID: 6403
|
||||
// (set) Token: 0x06009C98 RID: 40088 RVA: 0x0020A888 File Offset: 0x00208A88
|
||||
[Token(Token = "0x17001903")]
|
||||
public int IterationCount
|
||||
{
|
||||
[Token(Token = "0x6009C98")]
|
||||
[Address(RVA = "0x420360", Offset = "0x41F160", VA = "0x180420360")]
|
||||
set
|
||||
{
|
||||
this.iterationCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06009C99 RID: 40089 RVA: 0x0020A89C File Offset: 0x00208A9C
|
||||
[Token(Token = "0x6009C99")]
|
||||
[Address(RVA = "0x1CC8150", Offset = "0x1CC6F50", VA = "0x181CC8150", 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: 0x0400694C RID: 26956
|
||||
[Token(Token = "0x400694C")]
|
||||
public static readonly string PbeSha1_RC4_128 = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC4.identifier;
|
||||
|
||||
// Token: 0x0400694D RID: 26957
|
||||
[Token(Token = "0x400694D")]
|
||||
public static readonly string PbeSha1_RC4_40 = PkcsObjectIdentifiers.PbeWithShaAnd40BitRC4.identifier;
|
||||
|
||||
// Token: 0x0400694E RID: 26958
|
||||
[Token(Token = "0x400694E")]
|
||||
public static readonly string PbeSha1_3DES = PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc.identifier;
|
||||
|
||||
// Token: 0x0400694F RID: 26959
|
||||
[Token(Token = "0x400694F")]
|
||||
public static readonly string PbeSha1_2DES = PkcsObjectIdentifiers.PbeWithShaAnd2KeyTripleDesCbc.identifier;
|
||||
|
||||
// Token: 0x04006950 RID: 26960
|
||||
[Token(Token = "0x4006950")]
|
||||
public static readonly string PbeSha1_RC2_128 = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC2Cbc.identifier;
|
||||
|
||||
// Token: 0x04006951 RID: 26961
|
||||
[Token(Token = "0x4006951")]
|
||||
public static readonly string PbeSha1_RC2_40 = PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc.identifier;
|
||||
|
||||
// Token: 0x04006952 RID: 26962
|
||||
[FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4006952")]
|
||||
private char[] password;
|
||||
|
||||
// Token: 0x04006953 RID: 26963
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4006953")]
|
||||
private string algorithm;
|
||||
|
||||
// Token: 0x04006954 RID: 26964
|
||||
[FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4006954")]
|
||||
private int iterationCount;
|
||||
|
||||
// Token: 0x04006955 RID: 26965
|
||||
[FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x4006955")]
|
||||
private AsymmetricKeyParameter privKey;
|
||||
|
||||
// Token: 0x04006956 RID: 26966
|
||||
[FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x4006956")]
|
||||
private SecureRandom random;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user