269 lines
13 KiB
C#
269 lines
13 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
|
|
{
|
|
// Token: 0x02001B74 RID: 7028
|
|
[Token(Token = "0x2001B74")]
|
|
public class TlsECDHKeyExchange : AbstractTlsKeyExchange
|
|
{
|
|
// Token: 0x0600AEA0 RID: 44704 RVA: 0x0025FE64 File Offset: 0x0025E064
|
|
[Token(Token = "0x600AEA0")]
|
|
[Address(RVA = "0x19854B0", Offset = "0x19842B0", VA = "0x1819854B0")]
|
|
public TlsECDHKeyExchange(int keyExchange, IList supportedSignatureAlgorithms, int[] namedCurves, byte[] clientECPointFormats, byte[] serverECPointFormats)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600AEA0)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.TlsECDHKeyExchange::.ctor(System.Int32,System.Collections.IList,System.Int32[],System.Byte[],System.Byte[])
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_49:
|
|
stloc:InvalidOperationException(var_3_53, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("unsupported key exchange algorithm")))
|
|
}
|
|
|
|
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.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.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.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: 0x0600AEA1 RID: 44705 RVA: 0x0025FEC4 File Offset: 0x0025E0C4
|
|
[Token(Token = "0x600AEA1")]
|
|
[Address(RVA = "0x1984D30", Offset = "0x1983B30", VA = "0x181984D30", Slot = "20")]
|
|
public override void Init(TlsContext context)
|
|
{
|
|
base.Init(context);
|
|
if (this.mTlsSigner != 0)
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600AEA2 RID: 44706 RVA: 0x0025FEE4 File Offset: 0x0025E0E4
|
|
[Token(Token = "0x600AEA2")]
|
|
[Address(RVA = "0x1985340", Offset = "0x1984140", VA = "0x181985340", Slot = "21")]
|
|
public override void SkipServerCredentials()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600AEA3 RID: 44707 RVA: 0x0025FEF4 File Offset: 0x0025E0F4
|
|
[Token(Token = "0x600AEA3")]
|
|
[Address(RVA = "0x1984FC0", Offset = "0x1983DC0", VA = "0x181984FC0", Slot = "22")]
|
|
public override void ProcessServerCertificate(Certificate serverCertificate)
|
|
{
|
|
X509CertificateStructure[] certificateList;
|
|
AsymmetricKeyParameter asymmetricKeyParameter;
|
|
for (;;)
|
|
{
|
|
if (serverCertificate.Length == 0)
|
|
{
|
|
certificateList = serverCertificate.GetCertificateList();
|
|
asymmetricKeyParameter = PublicKeyFactory.CreateKey(certificateList.SubjectPublicKeyInfo);
|
|
this.mServerPublicKey = asymmetricKeyParameter;
|
|
if (this.mTlsSigner == 0 || asymmetricKeyParameter != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
this.mECAgreePublicKey = asymmetricKeyParameter;
|
|
TlsUtilities.ValidateKeyUsage(certificateList, 8);
|
|
base.ProcessServerCertificate(serverCertificate);
|
|
}
|
|
|
|
// Token: 0x17001BB2 RID: 7090
|
|
// (get) Token: 0x0600AEA4 RID: 44708 RVA: 0x0025FF48 File Offset: 0x0025E148
|
|
[Token(Token = "0x17001BB2")]
|
|
public override bool RequiresServerKeyExchange
|
|
{
|
|
[Token(Token = "0x600AEA4")]
|
|
[Address(RVA = "0x19855B0", Offset = "0x19843B0", VA = "0x1819855B0", Slot = "24")]
|
|
get
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = this.mKeyExchange;
|
|
if (num != 17)
|
|
{
|
|
num += -19;
|
|
if (num > 1)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600AEA5 RID: 44709 RVA: 0x0025FF6C File Offset: 0x0025E16C
|
|
[Token(Token = "0x600AEA5")]
|
|
[Address(RVA = "0x1984C10", Offset = "0x1983A10", VA = "0x181984C10", Slot = "25")]
|
|
public override byte[] GenerateServerKeyExchange()
|
|
{
|
|
MemoryStream memoryStream = new MemoryStream();
|
|
TlsContext mContext = this.mContext;
|
|
ECPrivateKeyParameters ecprivateKeyParameters;
|
|
this.mECAgreePrivateKey = ecprivateKeyParameters;
|
|
((IDisposable)memoryStream).Dispose();
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600AEA6 RID: 44710 RVA: 0x0025FF9C File Offset: 0x0025E19C
|
|
[Token(Token = "0x600AEA6")]
|
|
[Address(RVA = "0x1985230", Offset = "0x1984030", VA = "0x181985230", Slot = "27")]
|
|
public override void ProcessServerKeyExchange(Stream input)
|
|
{
|
|
int[] array = this.mNamedCurves;
|
|
byte[] array2 = this.mClientECPointFormats;
|
|
ECDomainParameters ecdomainParameters = TlsEccUtilities.ReadECParameters(array, array2, input);
|
|
byte[] array3 = TlsUtilities.ReadOpaque8(input);
|
|
ECPublicKeyParameters ecpublicKeyParameters = TlsEccUtilities.DeserializeECPublicKey(this.mClientECPointFormats, ecdomainParameters, array3);
|
|
this.mECAgreePublicKey = ecpublicKeyParameters;
|
|
}
|
|
|
|
// Token: 0x0600AEA7 RID: 44711 RVA: 0x0025FFE0 File Offset: 0x0025E1E0
|
|
[Token(Token = "0x600AEA7")]
|
|
[Address(RVA = "0x19853A0", Offset = "0x19841A0", VA = "0x1819853A0", Slot = "28")]
|
|
public override void ValidateCertificateRequest(CertificateRequest certificateRequest)
|
|
{
|
|
int num;
|
|
do
|
|
{
|
|
string text = certificateRequest.ToString();
|
|
num = 0;
|
|
}
|
|
while (18446744073709551615UL > (ulong)1L && 18446744073709551552UL > (ulong)2L);
|
|
num++;
|
|
}
|
|
|
|
// Token: 0x0600AEA8 RID: 44712 RVA: 0x00260008 File Offset: 0x0025E208
|
|
[Token(Token = "0x600AEA8")]
|
|
[Address(RVA = "0x1984DF0", Offset = "0x1983BF0", VA = "0x181984DF0", Slot = "30")]
|
|
public override void ProcessClientCredentials(TlsCredentials clientCredentials)
|
|
{
|
|
if (clientCredentials == 0)
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600AEA9 RID: 44713 RVA: 0x0026001C File Offset: 0x0025E21C
|
|
[Token(Token = "0x600AEA9")]
|
|
[Address(RVA = "0x1984A70", Offset = "0x1983870", VA = "0x181984A70", Slot = "32")]
|
|
public override void GenerateClientKeyExchange(Stream output)
|
|
{
|
|
if (this.mAgreementCredentials == (ulong)0L)
|
|
{
|
|
TlsContext mContext = this.mContext;
|
|
ECPublicKeyParameters ecpublicKeyParameters = this.mECAgreePublicKey;
|
|
ECPrivateKeyParameters ecprivateKeyParameters;
|
|
this.mECAgreePrivateKey = ecprivateKeyParameters;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600AEAA RID: 44714 RVA: 0x00260050 File Offset: 0x0025E250
|
|
[Token(Token = "0x600AEAA")]
|
|
[Address(RVA = "0x1984D90", Offset = "0x1983B90", VA = "0x181984D90", Slot = "31")]
|
|
public override void ProcessClientCertificate(Certificate clientCertificate)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600AEAB RID: 44715 RVA: 0x00260060 File Offset: 0x0025E260
|
|
[Token(Token = "0x600AEAB")]
|
|
[Address(RVA = "0x1984EF0", Offset = "0x1983CF0", VA = "0x181984EF0", Slot = "33")]
|
|
public override void ProcessClientKeyExchange(Stream input)
|
|
{
|
|
if (this.mECAgreePublicKey == (ulong)0L)
|
|
{
|
|
byte[] array = TlsUtilities.ReadOpaque8(input);
|
|
ECPrivateKeyParameters ecprivateKeyParameters = this.mECAgreePrivateKey;
|
|
byte[] array2 = this.mServerECPointFormats;
|
|
ECDomainParameters parameters = ecprivateKeyParameters.parameters;
|
|
ECPublicKeyParameters ecpublicKeyParameters = TlsEccUtilities.DeserializeECPublicKey(array2, parameters, array);
|
|
this.mECAgreePublicKey = ecpublicKeyParameters;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600AEAC RID: 44716 RVA: 0x002600AC File Offset: 0x0025E2AC
|
|
[Token(Token = "0x600AEAC")]
|
|
[Address(RVA = "0x1984B50", Offset = "0x1983950", VA = "0x181984B50", Slot = "34")]
|
|
public override byte[] GeneratePremasterSecret()
|
|
{
|
|
ECPrivateKeyParameters ecprivateKeyParameters;
|
|
for (;;)
|
|
{
|
|
if (this.mAgreementCredentials == 0)
|
|
{
|
|
ecprivateKeyParameters = this.mECAgreePrivateKey;
|
|
if (ecprivateKeyParameters != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return TlsEccUtilities.CalculateECDHBasicAgreement(this.mECAgreePublicKey, ecprivateKeyParameters);
|
|
}
|
|
|
|
// Token: 0x04007011 RID: 28689
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007011")]
|
|
protected TlsSigner mTlsSigner;
|
|
|
|
// Token: 0x04007012 RID: 28690
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007012")]
|
|
protected int[] mNamedCurves;
|
|
|
|
// Token: 0x04007013 RID: 28691
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007013")]
|
|
protected byte[] mClientECPointFormats;
|
|
|
|
// Token: 0x04007014 RID: 28692
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4007014")]
|
|
protected byte[] mServerECPointFormats;
|
|
|
|
// Token: 0x04007015 RID: 28693
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x4007015")]
|
|
protected AsymmetricKeyParameter mServerPublicKey;
|
|
|
|
// Token: 0x04007016 RID: 28694
|
|
[FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x4007016")]
|
|
protected TlsAgreementCredentials mAgreementCredentials;
|
|
|
|
// Token: 0x04007017 RID: 28695
|
|
[FieldOffset(Offset = "0x58")]
|
|
[Token(Token = "0x4007017")]
|
|
protected ECPrivateKeyParameters mECAgreePrivateKey;
|
|
|
|
// Token: 0x04007018 RID: 28696
|
|
[FieldOffset(Offset = "0x60")]
|
|
[Token(Token = "0x4007018")]
|
|
protected ECPublicKeyParameters mECAgreePublicKey;
|
|
}
|
|
}
|