oh dear
This commit is contained in:
@@ -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 1663
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x0400693B RID: 26939
|
||||
[FieldOffset(Offset = "0x18")]
|
||||
[Token(Token = "0x400693B")]
|
||||
private readonly IPasswordFinder pFinder;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user