277 lines
13 KiB
C#
277 lines
13 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Agreement;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
|
|
{
|
|
// Token: 0x02001597 RID: 5527
|
|
[Token(Token = "0x2001597")]
|
|
[StructLayout(3)]
|
|
public class TlsECDHKeyExchange : AbstractTlsKeyExchange
|
|
{
|
|
// Token: 0x060092C6 RID: 37574 RVA: 0x00208784 File Offset: 0x00206984
|
|
[Token(Token = "0x60092C6")]
|
|
[Address(RVA = "0x1E96EF0", Offset = "0x1E958F0", VA = "0x181E96EF0")]
|
|
public TlsECDHKeyExchange(int keyExchange, IList supportedSignatureAlgorithms, int[] namedCurves, byte[] clientECPointFormats, byte[] serverECPointFormats)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (060092C6)
|
|
|
|
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 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x060092C7 RID: 37575 RVA: 0x002087E4 File Offset: 0x002069E4
|
|
[Token(Token = "0x60092C7")]
|
|
[Address(RVA = "0x1E96770", Offset = "0x1E95170", VA = "0x181E96770", Slot = "20")]
|
|
public override void Init(TlsContext context)
|
|
{
|
|
base.Init(context);
|
|
if (this.mTlsSigner != 0)
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x060092C8 RID: 37576 RVA: 0x00208804 File Offset: 0x00206A04
|
|
[Token(Token = "0x60092C8")]
|
|
[Address(RVA = "0x1E96D80", Offset = "0x1E95780", VA = "0x181E96D80", Slot = "21")]
|
|
public override void SkipServerCredentials()
|
|
{
|
|
}
|
|
|
|
// Token: 0x060092C9 RID: 37577 RVA: 0x00208814 File Offset: 0x00206A14
|
|
[Token(Token = "0x60092C9")]
|
|
[Address(RVA = "0x1E96A00", Offset = "0x1E95400", VA = "0x181E96A00", 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: 0x170017B1 RID: 6065
|
|
// (get) Token: 0x060092CA RID: 37578 RVA: 0x00208868 File Offset: 0x00206A68
|
|
[Token(Token = "0x170017B1")]
|
|
public override bool RequiresServerKeyExchange
|
|
{
|
|
[Token(Token = "0x60092CA")]
|
|
[Address(RVA = "0x1E96FF0", Offset = "0x1E959F0", VA = "0x181E96FF0", Slot = "24")]
|
|
get
|
|
{
|
|
for (;;)
|
|
{
|
|
int num = this.mKeyExchange;
|
|
if (num != 17)
|
|
{
|
|
num += -19;
|
|
if (num > 1)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060092CB RID: 37579 RVA: 0x0020888C File Offset: 0x00206A8C
|
|
[Token(Token = "0x60092CB")]
|
|
[Address(RVA = "0x1E96650", Offset = "0x1E95050", VA = "0x181E96650", 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: 0x060092CC RID: 37580 RVA: 0x002088BC File Offset: 0x00206ABC
|
|
[Token(Token = "0x60092CC")]
|
|
[Address(RVA = "0x1E96C70", Offset = "0x1E95670", VA = "0x181E96C70", 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: 0x060092CD RID: 37581 RVA: 0x00208900 File Offset: 0x00206B00
|
|
[Token(Token = "0x60092CD")]
|
|
[Address(RVA = "0x1E96DE0", Offset = "0x1E957E0", VA = "0x181E96DE0", 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: 0x060092CE RID: 37582 RVA: 0x00208928 File Offset: 0x00206B28
|
|
[Token(Token = "0x60092CE")]
|
|
[Address(RVA = "0x1E96830", Offset = "0x1E95230", VA = "0x181E96830", Slot = "30")]
|
|
public override void ProcessClientCredentials(TlsCredentials clientCredentials)
|
|
{
|
|
if (clientCredentials == 0)
|
|
{
|
|
}
|
|
}
|
|
|
|
// Token: 0x060092CF RID: 37583 RVA: 0x0020893C File Offset: 0x00206B3C
|
|
[Token(Token = "0x60092CF")]
|
|
[Address(RVA = "0x1E96410", Offset = "0x1E94E10", VA = "0x181E96410", 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: 0x060092D0 RID: 37584 RVA: 0x00208970 File Offset: 0x00206B70
|
|
[Token(Token = "0x60092D0")]
|
|
[Address(RVA = "0x1E967D0", Offset = "0x1E951D0", VA = "0x181E967D0", Slot = "31")]
|
|
public override void ProcessClientCertificate(Certificate clientCertificate)
|
|
{
|
|
}
|
|
|
|
// Token: 0x060092D1 RID: 37585 RVA: 0x00208980 File Offset: 0x00206B80
|
|
[Token(Token = "0x60092D1")]
|
|
[Address(RVA = "0x1E96930", Offset = "0x1E95330", VA = "0x181E96930", 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: 0x060092D2 RID: 37586 RVA: 0x002089CC File Offset: 0x00206BCC
|
|
[Token(Token = "0x60092D2")]
|
|
[Address(RVA = "0x1E964F0", Offset = "0x1E94EF0", VA = "0x181E964F0", Slot = "34")]
|
|
public override byte[] GeneratePremasterSecret()
|
|
{
|
|
ECPrivateKeyParameters ecprivateKeyParameters;
|
|
for (;;)
|
|
{
|
|
if (this.mAgreementCredentials == 0)
|
|
{
|
|
ecprivateKeyParameters = this.mECAgreePrivateKey;
|
|
if (ecprivateKeyParameters != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
ECDHBasicAgreement ecdhbasicAgreement = new ECDHBasicAgreement();
|
|
BigInteger bigInteger = ecdhbasicAgreement.CalculateAgreement(ecprivateKeyParameters);
|
|
int fieldSize = ecdhbasicAgreement.GetFieldSize();
|
|
byte[] array;
|
|
return array;
|
|
}
|
|
|
|
// Token: 0x040061CE RID: 25038
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40061CE")]
|
|
protected TlsSigner mTlsSigner;
|
|
|
|
// Token: 0x040061CF RID: 25039
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40061CF")]
|
|
protected int[] mNamedCurves;
|
|
|
|
// Token: 0x040061D0 RID: 25040
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x40061D0")]
|
|
protected byte[] mClientECPointFormats;
|
|
|
|
// Token: 0x040061D1 RID: 25041
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x40061D1")]
|
|
protected byte[] mServerECPointFormats;
|
|
|
|
// Token: 0x040061D2 RID: 25042
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x40061D2")]
|
|
protected AsymmetricKeyParameter mServerPublicKey;
|
|
|
|
// Token: 0x040061D3 RID: 25043
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x40061D3")]
|
|
protected TlsAgreementCredentials mAgreementCredentials;
|
|
|
|
// Token: 0x040061D4 RID: 25044
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x58")]
|
|
[Token(Token = "0x40061D4")]
|
|
protected ECPrivateKeyParameters mECAgreePrivateKey;
|
|
|
|
// Token: 0x040061D5 RID: 25045
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x60")]
|
|
[Token(Token = "0x40061D5")]
|
|
protected ECPublicKeyParameters mECAgreePublicKey;
|
|
}
|
|
}
|