387 lines
14 KiB
C#
387 lines
14 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.IO;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
|
|
{
|
|
// Token: 0x02001C32 RID: 7218
|
|
[Token(Token = "0x2001C32")]
|
|
public sealed class SessionParameters
|
|
{
|
|
// Token: 0x0600B19B RID: 45467 RVA: 0x00266350 File Offset: 0x00264550
|
|
[Token(Token = "0x600B19B")]
|
|
[Address(RVA = "0x498700", Offset = "0x497700", VA = "0x180498700")]
|
|
private SessionParameters(int cipherSuite, byte compressionAlgorithm, byte[] masterSecret, Certificate peerCertificate, byte[] pskIdentity, byte[] srpIdentity, byte[] encodedServerExtensions, bool extendedMasterSecret)
|
|
{
|
|
this.mCipherSuite = cipherSuite;
|
|
this.mCompressionAlgorithm = compressionAlgorithm;
|
|
byte[] array = Arrays.Clone(masterSecret);
|
|
this.mMasterSecret = array;
|
|
this.mPeerCertificate = 0;
|
|
byte[] array2;
|
|
this.mPskIdentity = array2;
|
|
byte[] array3;
|
|
this.mSrpIdentity = array3;
|
|
this.mEncodedServerExtensions = 0;
|
|
this.mExtendedMasterSecret = false;
|
|
}
|
|
|
|
// Token: 0x0600B19C RID: 45468 RVA: 0x002663A4 File Offset: 0x002645A4
|
|
[Token(Token = "0x600B19C")]
|
|
[Address(RVA = "0x498550", Offset = "0x497550", VA = "0x180498550")]
|
|
public void Clear()
|
|
{
|
|
byte[] array = this.mMasterSecret;
|
|
if (array != 0)
|
|
{
|
|
int num = 0;
|
|
Arrays.Fill(array, (byte)num);
|
|
return;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B19D RID: 45469 RVA: 0x002663C8 File Offset: 0x002645C8
|
|
[Token(Token = "0x600B19D")]
|
|
[Address(RVA = "0x4985C0", Offset = "0x4975C0", VA = "0x1804985C0")]
|
|
public SessionParameters Copy()
|
|
{
|
|
int num = this.mCipherSuite;
|
|
byte b = this.mCompressionAlgorithm;
|
|
byte[] array = this.mMasterSecret;
|
|
Certificate certificate = this.mPeerCertificate;
|
|
byte[] array2 = this.mPskIdentity;
|
|
byte[] array3 = this.mSrpIdentity;
|
|
byte[] array4 = this.mEncodedServerExtensions;
|
|
bool flag = this.mExtendedMasterSecret;
|
|
return new SessionParameters(num, b, array, certificate, array2, array3, array4, flag);
|
|
}
|
|
|
|
// Token: 0x17001C2C RID: 7212
|
|
// (get) Token: 0x0600B19E RID: 45470 RVA: 0x00266424 File Offset: 0x00264624
|
|
[Token(Token = "0x17001C2C")]
|
|
public int CipherSuite
|
|
{
|
|
[Token(Token = "0x600B19E")]
|
|
[Address(RVA = "0x40F000", Offset = "0x40E000", VA = "0x18040F000")]
|
|
get
|
|
{
|
|
return this.mCipherSuite;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001C2D RID: 7213
|
|
// (get) Token: 0x0600B19F RID: 45471 RVA: 0x00266438 File Offset: 0x00264638
|
|
[Token(Token = "0x17001C2D")]
|
|
public byte CompressionAlgorithm
|
|
{
|
|
[Token(Token = "0x600B19F")]
|
|
[Address(RVA = "0x4987D0", Offset = "0x4977D0", VA = "0x1804987D0")]
|
|
get
|
|
{
|
|
return this.mCompressionAlgorithm;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001C2E RID: 7214
|
|
// (get) Token: 0x0600B1A0 RID: 45472 RVA: 0x0026644C File Offset: 0x0026464C
|
|
[Token(Token = "0x17001C2E")]
|
|
public bool IsExtendedMasterSecret
|
|
{
|
|
[Token(Token = "0x600B1A0")]
|
|
[Address(RVA = "0x41CF00", Offset = "0x41BF00", VA = "0x18041CF00")]
|
|
get
|
|
{
|
|
return this.mExtendedMasterSecret;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001C2F RID: 7215
|
|
// (get) Token: 0x0600B1A1 RID: 45473 RVA: 0x00266460 File Offset: 0x00264660
|
|
[Token(Token = "0x17001C2F")]
|
|
public byte[] MasterSecret
|
|
{
|
|
[Token(Token = "0x600B1A1")]
|
|
[Address(RVA = "0x4157B0", Offset = "0x4147B0", VA = "0x1804157B0")]
|
|
get
|
|
{
|
|
return this.mMasterSecret;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001C30 RID: 7216
|
|
// (get) Token: 0x0600B1A2 RID: 45474 RVA: 0x00266474 File Offset: 0x00264674
|
|
[Token(Token = "0x17001C30")]
|
|
public Certificate PeerCertificate
|
|
{
|
|
[Token(Token = "0x600B1A2")]
|
|
[Address(RVA = "0x4157C0", Offset = "0x4147C0", VA = "0x1804157C0")]
|
|
get
|
|
{
|
|
return this.mPeerCertificate;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001C31 RID: 7217
|
|
// (get) Token: 0x0600B1A3 RID: 45475 RVA: 0x00266488 File Offset: 0x00264688
|
|
[Token(Token = "0x17001C31")]
|
|
public byte[] PskIdentity
|
|
{
|
|
[Token(Token = "0x600B1A3")]
|
|
[Address(RVA = "0x4157D0", Offset = "0x4147D0", VA = "0x1804157D0")]
|
|
get
|
|
{
|
|
return this.mPskIdentity;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001C32 RID: 7218
|
|
// (get) Token: 0x0600B1A4 RID: 45476 RVA: 0x0026649C File Offset: 0x0026469C
|
|
[Token(Token = "0x17001C32")]
|
|
public byte[] SrpIdentity
|
|
{
|
|
[Token(Token = "0x600B1A4")]
|
|
[Address(RVA = "0x4157E0", Offset = "0x4147E0", VA = "0x1804157E0")]
|
|
get
|
|
{
|
|
return this.mSrpIdentity;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600B1A5 RID: 45477 RVA: 0x002664B0 File Offset: 0x002646B0
|
|
[Token(Token = "0x600B1A5")]
|
|
[Address(RVA = "0x498690", Offset = "0x497690", VA = "0x180498690")]
|
|
public IDictionary ReadServerExtensions()
|
|
{
|
|
byte[] array = this.mEncodedServerExtensions;
|
|
if (array != 0)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(array, num != 0);
|
|
num = 0;
|
|
return TlsProtocol.ReadExtensions(memoryStream);
|
|
}
|
|
}
|
|
|
|
// Token: 0x04007165 RID: 29029
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4007165")]
|
|
private int mCipherSuite;
|
|
|
|
// Token: 0x04007166 RID: 29030
|
|
[FieldOffset(Offset = "0x14")]
|
|
[Token(Token = "0x4007166")]
|
|
private byte mCompressionAlgorithm;
|
|
|
|
// Token: 0x04007167 RID: 29031
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4007167")]
|
|
private byte[] mMasterSecret;
|
|
|
|
// Token: 0x04007168 RID: 29032
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007168")]
|
|
private Certificate mPeerCertificate;
|
|
|
|
// Token: 0x04007169 RID: 29033
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007169")]
|
|
private byte[] mPskIdentity;
|
|
|
|
// Token: 0x0400716A RID: 29034
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400716A")]
|
|
private byte[] mSrpIdentity;
|
|
|
|
// Token: 0x0400716B RID: 29035
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x400716B")]
|
|
private byte[] mEncodedServerExtensions;
|
|
|
|
// Token: 0x0400716C RID: 29036
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x400716C")]
|
|
private bool mExtendedMasterSecret;
|
|
|
|
// Token: 0x02001C33 RID: 7219
|
|
[Token(Token = "0x2001C33")]
|
|
public sealed class Builder
|
|
{
|
|
// Token: 0x0600B1A6 RID: 45478 RVA: 0x002664DC File Offset: 0x002646DC
|
|
[Token(Token = "0x600B1A6")]
|
|
[Address(RVA = "0x4939B0", Offset = "0x4929B0", VA = "0x1804939B0")]
|
|
public Builder()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600B1A7 RID: 45479 RVA: 0x00266500 File Offset: 0x00264700
|
|
[Token(Token = "0x600B1A7")]
|
|
[Address(RVA = "0x4936F0", Offset = "0x4926F0", VA = "0x1804936F0")]
|
|
public SessionParameters Build()
|
|
{
|
|
int num = this.mCipherSuite;
|
|
this.Validate(num != 0, "cipherSuite");
|
|
short num2 = this.mCompressionAlgorithm;
|
|
this.Validate(num2 != 0, "compressionAlgorithm");
|
|
this.Validate(num2 != 0, "masterSecret");
|
|
int num3 = this.mCipherSuite;
|
|
short num4 = this.mCompressionAlgorithm;
|
|
byte[] array = this.mMasterSecret;
|
|
Certificate certificate = this.mPeerCertificate;
|
|
byte[] array2 = this.mPskIdentity;
|
|
byte[] array3 = this.mSrpIdentity;
|
|
byte[] array4 = this.mEncodedServerExtensions;
|
|
bool flag = this.mExtendedMasterSecret;
|
|
return new SessionParameters(num3, (byte)num4, array, certificate, array2, array3, array4, flag);
|
|
}
|
|
|
|
// Token: 0x0600B1A8 RID: 45480 RVA: 0x00266590 File Offset: 0x00264790
|
|
[Token(Token = "0x600B1A8")]
|
|
[Address(RVA = "0x493810", Offset = "0x492810", VA = "0x180493810")]
|
|
public SessionParameters.Builder SetCipherSuite(int cipherSuite)
|
|
{
|
|
this.mCipherSuite = cipherSuite;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x0600B1A9 RID: 45481 RVA: 0x002665A8 File Offset: 0x002647A8
|
|
[Token(Token = "0x600B1A9")]
|
|
[Address(RVA = "0x493820", Offset = "0x492820", VA = "0x180493820")]
|
|
public SessionParameters.Builder SetCompressionAlgorithm(byte compressionAlgorithm)
|
|
{
|
|
this.mCompressionAlgorithm = (short)compressionAlgorithm;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x0600B1AA RID: 45482 RVA: 0x002665C0 File Offset: 0x002647C0
|
|
[Token(Token = "0x600B1AA")]
|
|
[Address(RVA = "0x493830", Offset = "0x492830", VA = "0x180493830")]
|
|
public SessionParameters.Builder SetExtendedMasterSecret(bool extendedMasterSecret)
|
|
{
|
|
this.mExtendedMasterSecret = extendedMasterSecret;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x0600B1AB RID: 45483 RVA: 0x002665D8 File Offset: 0x002647D8
|
|
[Token(Token = "0x600B1AB")]
|
|
[Address(RVA = "0x493840", Offset = "0x492840", VA = "0x180493840")]
|
|
public SessionParameters.Builder SetMasterSecret(byte[] masterSecret)
|
|
{
|
|
this.mMasterSecret = masterSecret;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x0600B1AC RID: 45484 RVA: 0x002665F0 File Offset: 0x002647F0
|
|
[Token(Token = "0x600B1AC")]
|
|
[Address(RVA = "0x493850", Offset = "0x492850", VA = "0x180493850")]
|
|
public SessionParameters.Builder SetPeerCertificate(Certificate peerCertificate)
|
|
{
|
|
this.mPeerCertificate = peerCertificate;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x0600B1AD RID: 45485 RVA: 0x00266608 File Offset: 0x00264808
|
|
[Token(Token = "0x600B1AD")]
|
|
[Address(RVA = "0x493860", Offset = "0x492860", VA = "0x180493860")]
|
|
public SessionParameters.Builder SetPskIdentity(byte[] pskIdentity)
|
|
{
|
|
this.mPskIdentity = pskIdentity;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x0600B1AE RID: 45486 RVA: 0x00266620 File Offset: 0x00264820
|
|
[Token(Token = "0x600B1AE")]
|
|
[Address(RVA = "0x493910", Offset = "0x492910", VA = "0x180493910")]
|
|
public SessionParameters.Builder SetSrpIdentity(byte[] srpIdentity)
|
|
{
|
|
this.mSrpIdentity = srpIdentity;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x0600B1AF RID: 45487 RVA: 0x00266638 File Offset: 0x00264838
|
|
[Token(Token = "0x600B1AF")]
|
|
[Address(RVA = "0x493870", Offset = "0x492870", VA = "0x180493870")]
|
|
public SessionParameters.Builder SetServerExtensions(IDictionary serverExtensions)
|
|
{
|
|
if (serverExtensions != 0)
|
|
{
|
|
TlsProtocol.WriteExtensions(new MemoryStream(), serverExtensions);
|
|
}
|
|
int num = 0;
|
|
this.mEncodedServerExtensions = num;
|
|
return this;
|
|
}
|
|
|
|
// Token: 0x0600B1B0 RID: 45488 RVA: 0x00266664 File Offset: 0x00264864
|
|
[Token(Token = "0x600B1B0")]
|
|
[Address(RVA = "0x493920", Offset = "0x492920", VA = "0x180493920")]
|
|
private void Validate(bool condition, string parameter)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600B1B0)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls.SessionParameters/Builder::Validate(System.Boolean,System.String)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_05:
|
|
stloc:InvalidOperationException(var_0_1A, newobj:InvalidOperationException(InvalidOperationException::.ctor, call:string(string::Concat, ldstr:string("Required session parameter '"), ldloc:string(parameter), ldstr:string("' not configured"))))
|
|
}
|
|
|
|
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: 0x0400716D RID: 29037
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400716D")]
|
|
private int mCipherSuite = (int)((uint)(-1));
|
|
|
|
// Token: 0x0400716E RID: 29038
|
|
[FieldOffset(Offset = "0x14")]
|
|
[Token(Token = "0x400716E")]
|
|
private short mCompressionAlgorithm = (short)((uint)(-1));
|
|
|
|
// Token: 0x0400716F RID: 29039
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400716F")]
|
|
private byte[] mMasterSecret;
|
|
|
|
// Token: 0x04007170 RID: 29040
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4007170")]
|
|
private Certificate mPeerCertificate;
|
|
|
|
// Token: 0x04007171 RID: 29041
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4007171")]
|
|
private byte[] mPskIdentity;
|
|
|
|
// Token: 0x04007172 RID: 29042
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4007172")]
|
|
private byte[] mSrpIdentity;
|
|
|
|
// Token: 0x04007173 RID: 29043
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007173")]
|
|
private byte[] mEncodedServerExtensions;
|
|
|
|
// Token: 0x04007174 RID: 29044
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4007174")]
|
|
private bool mExtendedMasterSecret;
|
|
}
|
|
}
|
|
}
|