scripts
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace Mono.Security.Protocol.Tls.Handshake.Client
|
||||
{
|
||||
// Token: 0x020000AE RID: 174
|
||||
internal class TlsServerFinished : HandshakeMessage
|
||||
{
|
||||
// Token: 0x06000687 RID: 1671 RVA: 0x00024840 File Offset: 0x00022A40
|
||||
public TlsServerFinished(Context context, byte[] buffer)
|
||||
: base(context, HandshakeType.Finished, buffer)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06000689 RID: 1673 RVA: 0x00024864 File Offset: 0x00022A64
|
||||
public override void Update()
|
||||
{
|
||||
base.Update();
|
||||
base.Context.HandshakeState = HandshakeState.Finished;
|
||||
}
|
||||
|
||||
// Token: 0x0600068A RID: 1674 RVA: 0x00024878 File Offset: 0x00022A78
|
||||
protected override void ProcessAsSsl3()
|
||||
{
|
||||
HashAlgorithm hashAlgorithm = new SslHandshakeHash(base.Context.MasterSecret);
|
||||
byte[] array = base.Context.HandshakeMessages.ToArray();
|
||||
hashAlgorithm.TransformBlock(array, 0, array.Length, array, 0);
|
||||
hashAlgorithm.TransformBlock(TlsServerFinished.Ssl3Marker, 0, TlsServerFinished.Ssl3Marker.Length, TlsServerFinished.Ssl3Marker, 0);
|
||||
hashAlgorithm.TransformFinalBlock(CipherSuite.EmptyArray, 0, 0);
|
||||
byte[] array2 = base.ReadBytes((int)this.Length);
|
||||
byte[] hash = hashAlgorithm.Hash;
|
||||
if (!HandshakeMessage.Compare(hash, array2))
|
||||
{
|
||||
throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid ServerFinished message received.");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600068B RID: 1675 RVA: 0x0002490C File Offset: 0x00022B0C
|
||||
protected override void ProcessAsTls1()
|
||||
{
|
||||
byte[] array = base.ReadBytes((int)this.Length);
|
||||
HashAlgorithm hashAlgorithm = new MD5SHA1();
|
||||
byte[] array2 = base.Context.HandshakeMessages.ToArray();
|
||||
byte[] array3 = hashAlgorithm.ComputeHash(array2, 0, array2.Length);
|
||||
byte[] array4 = base.Context.Current.Cipher.PRF(base.Context.MasterSecret, "server finished", array3, 12);
|
||||
if (!HandshakeMessage.Compare(array4, array))
|
||||
{
|
||||
throw new TlsException("Invalid ServerFinished message received.");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000322 RID: 802
|
||||
private static byte[] Ssl3Marker = new byte[] { 83, 82, 86, 82 };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user