m
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x02001A75 RID: 6773
|
||||
[Token(Token = "0x2001A75")]
|
||||
public interface IPasswordFinder
|
||||
{
|
||||
// Token: 0x0600A044 RID: 41028
|
||||
[Token(Token = "0x600A044")]
|
||||
[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: 0x02001A76 RID: 6774
|
||||
[Token(Token = "0x2001A76")]
|
||||
public class MiscPemGenerator : PemObjectGenerator
|
||||
{
|
||||
// Token: 0x0600A045 RID: 41029 RVA: 0x00212D74 File Offset: 0x00210F74
|
||||
[Token(Token = "0x600A045")]
|
||||
[Address(RVA = "0x493D90", Offset = "0x492D90", VA = "0x180493D90")]
|
||||
public MiscPemGenerator(object obj)
|
||||
{
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
// Token: 0x0600A046 RID: 41030 RVA: 0x00212D90 File Offset: 0x00210F90
|
||||
[Token(Token = "0x600A046")]
|
||||
[Address(RVA = "0x72B040", Offset = "0x72A040", VA = "0x18072B040")]
|
||||
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: 0x0600A047 RID: 41031 RVA: 0x00212DC4 File Offset: 0x00210FC4
|
||||
[Token(Token = "0x600A047")]
|
||||
[Address(RVA = "0xCF13F0", Offset = "0xCF03F0", VA = "0x180CF13F0")]
|
||||
private static PemObject CreatePemObject(object obj)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600A047)
|
||||
|
||||
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: 0x0600A048 RID: 41032 RVA: 0x00212E68 File Offset: 0x00211068
|
||||
[Token(Token = "0x600A048")]
|
||||
[Address(RVA = "0xCF0F60", Offset = "0xCEFF60", VA = "0x180CF0F60")]
|
||||
private static PemObject CreatePemObject(object obj, string algorithm, char[] password, SecureRandom random)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600A048)
|
||||
|
||||
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: 0x0600A049 RID: 41033 RVA: 0x00212F54 File Offset: 0x00211154
|
||||
[Token(Token = "0x600A049")]
|
||||
[Address(RVA = "0xCF1A50", Offset = "0xCF0A50", VA = "0x180CF1A50")]
|
||||
private static byte[] EncodePrivateKey(AsymmetricKeyParameter akp, out string keyType)
|
||||
{
|
||||
PrivateKeyInfo privateKeyInfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo(akp);
|
||||
TypeCode typeCode = privateKeyInfo.HasPublicKey.GetTypeCode();
|
||||
return privateKeyInfo.PrivateKeyAlgorithm.GetEncoded();
|
||||
}
|
||||
|
||||
// Token: 0x0600A04A RID: 41034 RVA: 0x00213074 File Offset: 0x00211274
|
||||
[Token(Token = "0x600A04A")]
|
||||
[Address(RVA = "0xCF20C0", Offset = "0xCF10C0", VA = "0x180CF20C0", 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: 0x04006AF0 RID: 27376
|
||||
[FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4006AF0")]
|
||||
private object obj;
|
||||
|
||||
// Token: 0x04006AF1 RID: 27377
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4006AF1")]
|
||||
private string algorithm;
|
||||
|
||||
// Token: 0x04006AF2 RID: 27378
|
||||
[FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4006AF2")]
|
||||
private char[] password;
|
||||
|
||||
// Token: 0x04006AF3 RID: 27379
|
||||
[FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x4006AF3")]
|
||||
private SecureRandom random;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x02001A77 RID: 6775
|
||||
[Token(Token = "0x2001A77")]
|
||||
[Serializable]
|
||||
public class PemException : IOException
|
||||
{
|
||||
// Token: 0x0600A04B RID: 41035 RVA: 0x002130B8 File Offset: 0x002112B8
|
||||
[Token(Token = "0x600A04B")]
|
||||
[Address(RVA = "0x4F0D40", Offset = "0x4EFD40", VA = "0x1804F0D40")]
|
||||
public PemException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600A04C RID: 41036 RVA: 0x002130CC File Offset: 0x002112CC
|
||||
[Token(Token = "0x600A04C")]
|
||||
[Address(RVA = "0x4A7900", Offset = "0x4A6900", VA = "0x1804A7900")]
|
||||
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: 0x02001A78 RID: 6776
|
||||
[Token(Token = "0x2001A78")]
|
||||
public class PemReader : PemReader
|
||||
{
|
||||
// Token: 0x0600A04D RID: 41037 RVA: 0x0000220F File Offset: 0x0000040F
|
||||
[Token(Token = "0x600A04D")]
|
||||
[Address(RVA = "0x4242D0", Offset = "0x4232D0", VA = "0x1804242D0")]
|
||||
static PemReader()
|
||||
{
|
||||
throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
|
||||
}
|
||||
|
||||
// Token: 0x0600A04E RID: 41038 RVA: 0x002130E4 File Offset: 0x002112E4
|
||||
[Token(Token = "0x600A04E")]
|
||||
[Address(RVA = "0xD05980", Offset = "0xD04980", VA = "0x180D05980")]
|
||||
public PemReader(TextReader reader)
|
||||
: base(reader)
|
||||
{
|
||||
this.pFinder = (ulong)0L;
|
||||
}
|
||||
|
||||
// Token: 0x0600A04F RID: 41039 RVA: 0x00213104 File Offset: 0x00211304
|
||||
[Token(Token = "0x600A04F")]
|
||||
[Address(RVA = "0xD05950", Offset = "0xD04950", VA = "0x180D05950")]
|
||||
public PemReader(TextReader reader, IPasswordFinder pFinder)
|
||||
: base(reader)
|
||||
{
|
||||
this.pFinder = pFinder;
|
||||
}
|
||||
|
||||
// Token: 0x0600A050 RID: 41040 RVA: 0x00213120 File Offset: 0x00211320
|
||||
[Token(Token = "0x600A050")]
|
||||
[Address(RVA = "0xD04720", Offset = "0xD03720", VA = "0x180D04720")]
|
||||
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: 0x0600A051 RID: 41041 RVA: 0x002132C4 File Offset: 0x002114C4
|
||||
[Token(Token = "0x600A051")]
|
||||
[Address(RVA = "0xD058B0", Offset = "0xD048B0", VA = "0x180D058B0")]
|
||||
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: 0x0600A052 RID: 41042 RVA: 0x00213304 File Offset: 0x00211504
|
||||
[Token(Token = "0x600A052")]
|
||||
[Address(RVA = "0xD05880", Offset = "0xD04880", VA = "0x180D05880")]
|
||||
private AsymmetricKeyParameter ReadPublicKey(PemObject pemObject)
|
||||
{
|
||||
return PublicKeyFactory.CreateKey(pemObject.content);
|
||||
}
|
||||
|
||||
// Token: 0x0600A053 RID: 41043 RVA: 0x00213324 File Offset: 0x00211524
|
||||
[Token(Token = "0x600A053")]
|
||||
[Address(RVA = "0xD04540", Offset = "0xD03540", VA = "0x180D04540")]
|
||||
private X509Certificate ReadCertificate(PemObject pemObject)
|
||||
{
|
||||
X509CertificateParser x509CertificateParser = new X509CertificateParser();
|
||||
byte[] content = pemObject.content;
|
||||
return x509CertificateParser.ReadCertificate(content);
|
||||
}
|
||||
|
||||
// Token: 0x0600A054 RID: 41044 RVA: 0x00213360 File Offset: 0x00211560
|
||||
[Token(Token = "0x600A054")]
|
||||
[Address(RVA = "0xD04630", Offset = "0xD03630", VA = "0x180D04630")]
|
||||
private X509Crl ReadCrl(PemObject pemObject)
|
||||
{
|
||||
X509CrlParser x509CrlParser = new X509CrlParser();
|
||||
byte[] content = pemObject.content;
|
||||
return x509CrlParser.ReadCrl(content);
|
||||
}
|
||||
|
||||
// Token: 0x0600A055 RID: 41045 RVA: 0x0021339C File Offset: 0x0021159C
|
||||
[Token(Token = "0x600A055")]
|
||||
[Address(RVA = "0xD04460", Offset = "0xD03460", VA = "0x180D04460")]
|
||||
private Pkcs10CertificationRequest ReadCertificateRequest(PemObject pemObject)
|
||||
{
|
||||
return new Pkcs10CertificationRequest(pemObject.content);
|
||||
}
|
||||
|
||||
// Token: 0x0600A056 RID: 41046 RVA: 0x002133C8 File Offset: 0x002115C8
|
||||
[Token(Token = "0x600A056")]
|
||||
[Address(RVA = "0xD043F0", Offset = "0xD033F0", VA = "0x180D043F0")]
|
||||
private IX509AttributeCertificate ReadAttributeCertificate(PemObject pemObject)
|
||||
{
|
||||
X509V2AttributeCertificate x509V2AttributeCertificate = new X509V2AttributeCertificate(pemObject.content);
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600A057 RID: 41047 RVA: 0x002133E8 File Offset: 0x002115E8
|
||||
[Token(Token = "0x600A057")]
|
||||
[Address(RVA = "0xD04B10", Offset = "0xD03B10", VA = "0x180D04B10")]
|
||||
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: 0x0600A058 RID: 41048 RVA: 0x00213418 File Offset: 0x00211618
|
||||
[Token(Token = "0x600A058")]
|
||||
[Address(RVA = "0xD04BE0", Offset = "0xD03BE0", VA = "0x180D04BE0")]
|
||||
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: 0x0600A059 RID: 41049 RVA: 0x00213620 File Offset: 0x00211820
|
||||
[Token(Token = "0x600A059")]
|
||||
[Address(RVA = "0xD04330", Offset = "0xD03330", VA = "0x180D04330")]
|
||||
private static X9ECParameters GetCurveParameters(string name)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600A059)
|
||||
|
||||
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: 0x04006AF4 RID: 27380
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4006AF4")]
|
||||
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: 0x02001A79 RID: 6777
|
||||
[Token(Token = "0x2001A79")]
|
||||
internal sealed class PemUtilities
|
||||
{
|
||||
// Token: 0x0600A05A RID: 41050 RVA: 0x00213654 File Offset: 0x00211854
|
||||
[Token(Token = "0x600A05A")]
|
||||
[Address(RVA = "0x63F7F0", Offset = "0x63E7F0", VA = "0x18063F7F0")]
|
||||
static PemUtilities()
|
||||
{
|
||||
Enum arbitraryValue = Enums.GetArbitraryValue(typeof(PemUtilities.PemBaseAlg));
|
||||
Enum arbitraryValue2 = Enums.GetArbitraryValue(typeof(PemUtilities.PemMode));
|
||||
}
|
||||
|
||||
// Token: 0x0600A05B RID: 41051 RVA: 0x0021369C File Offset: 0x0021189C
|
||||
[Token(Token = "0x600A05B")]
|
||||
[Address(RVA = "0x63F570", Offset = "0x63E570", VA = "0x18063F570")]
|
||||
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: 0x0600A05C RID: 41052 RVA: 0x00213744 File Offset: 0x00211944
|
||||
[Token(Token = "0x600A05C")]
|
||||
[Address(RVA = "0x63EDD0", Offset = "0x63DDD0", VA = "0x18063EDD0")]
|
||||
internal static byte[] Crypt(bool encrypt, byte[] bytes, char[] password, string dekAlgName, byte[] iv)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600A05C)
|
||||
|
||||
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: 0x0600A05D RID: 41053 RVA: 0x0021381C File Offset: 0x00211A1C
|
||||
[Token(Token = "0x600A05D")]
|
||||
[Address(RVA = "0x63F3E0", Offset = "0x63E3E0", VA = "0x18063F3E0")]
|
||||
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: 0x0600A05E RID: 41054 RVA: 0x00213844 File Offset: 0x00211A44
|
||||
[Token(Token = "0x600A05E")]
|
||||
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
||||
public PemUtilities()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x02001A7A RID: 6778
|
||||
[Token(Token = "0x2001A7A")]
|
||||
private enum PemBaseAlg
|
||||
{
|
||||
// Token: 0x04006AF6 RID: 27382
|
||||
[Token(Token = "0x4006AF6")]
|
||||
AES_128,
|
||||
// Token: 0x04006AF7 RID: 27383
|
||||
[Token(Token = "0x4006AF7")]
|
||||
AES_192,
|
||||
// Token: 0x04006AF8 RID: 27384
|
||||
[Token(Token = "0x4006AF8")]
|
||||
AES_256,
|
||||
// Token: 0x04006AF9 RID: 27385
|
||||
[Token(Token = "0x4006AF9")]
|
||||
BF,
|
||||
// Token: 0x04006AFA RID: 27386
|
||||
[Token(Token = "0x4006AFA")]
|
||||
DES,
|
||||
// Token: 0x04006AFB RID: 27387
|
||||
[Token(Token = "0x4006AFB")]
|
||||
DES_EDE,
|
||||
// Token: 0x04006AFC RID: 27388
|
||||
[Token(Token = "0x4006AFC")]
|
||||
DES_EDE3,
|
||||
// Token: 0x04006AFD RID: 27389
|
||||
[Token(Token = "0x4006AFD")]
|
||||
RC2,
|
||||
// Token: 0x04006AFE RID: 27390
|
||||
[Token(Token = "0x4006AFE")]
|
||||
RC2_40,
|
||||
// Token: 0x04006AFF RID: 27391
|
||||
[Token(Token = "0x4006AFF")]
|
||||
RC2_64
|
||||
}
|
||||
|
||||
// Token: 0x02001A7B RID: 6779
|
||||
[Token(Token = "0x2001A7B")]
|
||||
private enum PemMode
|
||||
{
|
||||
// Token: 0x04006B01 RID: 27393
|
||||
[Token(Token = "0x4006B01")]
|
||||
CBC,
|
||||
// Token: 0x04006B02 RID: 27394
|
||||
[Token(Token = "0x4006B02")]
|
||||
CFB,
|
||||
// Token: 0x04006B03 RID: 27395
|
||||
[Token(Token = "0x4006B03")]
|
||||
ECB,
|
||||
// Token: 0x04006B04 RID: 27396
|
||||
[Token(Token = "0x4006B04")]
|
||||
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: 0x02001A7C RID: 6780
|
||||
[Token(Token = "0x2001A7C")]
|
||||
public class PemWriter : PemWriter
|
||||
{
|
||||
// Token: 0x0600A05F RID: 41055 RVA: 0x00213858 File Offset: 0x00211A58
|
||||
[Token(Token = "0x600A05F")]
|
||||
[Address(RVA = "0x63FAF0", Offset = "0x63EAF0", VA = "0x18063FAF0")]
|
||||
public PemWriter(TextWriter writer)
|
||||
: base(writer)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600A060 RID: 41056 RVA: 0x0021386C File Offset: 0x00211A6C
|
||||
[Token(Token = "0x600A060")]
|
||||
[Address(RVA = "0x63F960", Offset = "0x63E960", VA = "0x18063F960")]
|
||||
public void WriteObject(object obj)
|
||||
{
|
||||
MiscPemGenerator miscPemGenerator = new MiscPemGenerator(obj);
|
||||
base.WriteObject(miscPemGenerator);
|
||||
}
|
||||
|
||||
// Token: 0x0600A061 RID: 41057 RVA: 0x00213888 File Offset: 0x00211A88
|
||||
[Token(Token = "0x600A061")]
|
||||
[Address(RVA = "0x63FA50", Offset = "0x63EA50", VA = "0x18063FA50")]
|
||||
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: 0x02001A7D RID: 6781
|
||||
[Token(Token = "0x2001A7D")]
|
||||
public class Pkcs8Generator : PemObjectGenerator
|
||||
{
|
||||
// Token: 0x0600A062 RID: 41058 RVA: 0x0021389C File Offset: 0x00211A9C
|
||||
[Token(Token = "0x600A062")]
|
||||
[Address(RVA = "0x64A990", Offset = "0x649990", VA = "0x18064A990")]
|
||||
public Pkcs8Generator(AsymmetricKeyParameter privKey)
|
||||
{
|
||||
this.privKey = privKey;
|
||||
}
|
||||
|
||||
// Token: 0x0600A063 RID: 41059 RVA: 0x002138B8 File Offset: 0x00211AB8
|
||||
[Token(Token = "0x600A063")]
|
||||
[Address(RVA = "0x64A950", Offset = "0x649950", VA = "0x18064A950")]
|
||||
public Pkcs8Generator(AsymmetricKeyParameter privKey, string algorithm)
|
||||
{
|
||||
this.privKey = privKey;
|
||||
this.algorithm = algorithm;
|
||||
this.iterationCount = (int)((ulong)2048L);
|
||||
}
|
||||
|
||||
// Token: 0x1700199E RID: 6558
|
||||
// (set) Token: 0x0600A064 RID: 41060 RVA: 0x002138E8 File Offset: 0x00211AE8
|
||||
[Token(Token = "0x1700199E")]
|
||||
public SecureRandom SecureRandom
|
||||
{
|
||||
[Token(Token = "0x600A064")]
|
||||
[Address(RVA = "0x415830", Offset = "0x414830", VA = "0x180415830")]
|
||||
set
|
||||
{
|
||||
this.random = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700199F RID: 6559
|
||||
// (set) Token: 0x0600A065 RID: 41061 RVA: 0x002138FC File Offset: 0x00211AFC
|
||||
[Token(Token = "0x1700199F")]
|
||||
public char[] Password
|
||||
{
|
||||
[Token(Token = "0x600A065")]
|
||||
[Address(RVA = "0x415800", Offset = "0x414800", VA = "0x180415800")]
|
||||
set
|
||||
{
|
||||
this.password = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170019A0 RID: 6560
|
||||
// (set) Token: 0x0600A066 RID: 41062 RVA: 0x00213910 File Offset: 0x00211B10
|
||||
[Token(Token = "0x170019A0")]
|
||||
public int IterationCount
|
||||
{
|
||||
[Token(Token = "0x600A066")]
|
||||
[Address(RVA = "0x62ADB0", Offset = "0x629DB0", VA = "0x18062ADB0")]
|
||||
set
|
||||
{
|
||||
this.iterationCount = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600A067 RID: 41063 RVA: 0x00213924 File Offset: 0x00211B24
|
||||
[Token(Token = "0x600A067")]
|
||||
[Address(RVA = "0x64A600", Offset = "0x649600", VA = "0x18064A600", 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: 0x04006B05 RID: 27397
|
||||
[Token(Token = "0x4006B05")]
|
||||
public static readonly string PbeSha1_RC4_128 = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC4.identifier;
|
||||
|
||||
// Token: 0x04006B06 RID: 27398
|
||||
[Token(Token = "0x4006B06")]
|
||||
public static readonly string PbeSha1_RC4_40 = PkcsObjectIdentifiers.PbeWithShaAnd40BitRC4.identifier;
|
||||
|
||||
// Token: 0x04006B07 RID: 27399
|
||||
[Token(Token = "0x4006B07")]
|
||||
public static readonly string PbeSha1_3DES = PkcsObjectIdentifiers.PbeWithShaAnd3KeyTripleDesCbc.identifier;
|
||||
|
||||
// Token: 0x04006B08 RID: 27400
|
||||
[Token(Token = "0x4006B08")]
|
||||
public static readonly string PbeSha1_2DES = PkcsObjectIdentifiers.PbeWithShaAnd2KeyTripleDesCbc.identifier;
|
||||
|
||||
// Token: 0x04006B09 RID: 27401
|
||||
[Token(Token = "0x4006B09")]
|
||||
public static readonly string PbeSha1_RC2_128 = PkcsObjectIdentifiers.PbeWithShaAnd128BitRC2Cbc.identifier;
|
||||
|
||||
// Token: 0x04006B0A RID: 27402
|
||||
[Token(Token = "0x4006B0A")]
|
||||
public static readonly string PbeSha1_RC2_40 = PkcsObjectIdentifiers.PbewithShaAnd40BitRC2Cbc.identifier;
|
||||
|
||||
// Token: 0x04006B0B RID: 27403
|
||||
[FieldOffset(Offset = "0x10")]
|
||||
[Token(Token = "0x4006B0B")]
|
||||
private char[] password;
|
||||
|
||||
// Token: 0x04006B0C RID: 27404
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x4006B0C")]
|
||||
private string algorithm;
|
||||
|
||||
// Token: 0x04006B0D RID: 27405
|
||||
[FieldOffset(Offset = "0x20")]
|
||||
[Token(Token = "0x4006B0D")]
|
||||
private int iterationCount;
|
||||
|
||||
// Token: 0x04006B0E RID: 27406
|
||||
[FieldOffset(Offset = "0x28")]
|
||||
[Token(Token = "0x4006B0E")]
|
||||
private AsymmetricKeyParameter privKey;
|
||||
|
||||
// Token: 0x04006B0F RID: 27407
|
||||
[FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x4006B0F")]
|
||||
private SecureRandom random;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user