示例#1
0
        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(Ssl3Marker, 0, Ssl3Marker.Length, Ssl3Marker, 0);
            hashAlgorithm.TransformFinalBlock(CipherSuite.EmptyArray, 0, 0);
            Write(hashAlgorithm.Hash);
        }
示例#2
0
        protected override void ProcessAsSsl3()
        {
            // Compute handshake messages hashes
            HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret);

            byte[] data = this.Context.HandshakeMessages.ToArray();
            hash.TransformBlock(data, 0, data.Length, data, 0);
            hash.TransformBlock(Ssl3Marker, 0, Ssl3Marker.Length, Ssl3Marker, 0);
            // hack to avoid memory allocation
            hash.TransformFinalBlock(CipherSuite.EmptyArray, 0, 0);

            this.Write(hash.Hash);
        }
示例#3
0
		protected override void ProcessAsSsl3()
		{
			// Compute handshake messages hashes
			HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret);

			byte[] data = this.Context.HandshakeMessages.ToArray ();
			hash.TransformBlock (data, 0, data.Length, data, 0);
			hash.TransformBlock (Ssl3Marker, 0, Ssl3Marker.Length, Ssl3Marker, 0);
			// hack to avoid memory allocation
			hash.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0);

			this.Write (hash.Hash);
		}
示例#4
0
        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(Ssl3Marker, 0, Ssl3Marker.Length, Ssl3Marker, 0);
            hashAlgorithm.TransformFinalBlock(CipherSuite.EmptyArray, 0, 0);
            byte[] buffer = ReadBytes((int)Length);
            byte[] hash   = hashAlgorithm.Hash;
            if (!HandshakeMessage.Compare(hash, buffer))
            {
                throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid ServerFinished message received.");
            }
        }
示例#5
0
        protected override void ProcessAsSsl3()
        {
            // Compute handshake messages hashes
            HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret);

            byte[] data = this.Context.HandshakeMessages.ToArray();
            hash.TransformBlock(data, 0, data.Length, data, 0);
            hash.TransformBlock(Ssl3Marker, 0, Ssl3Marker.Length, Ssl3Marker, 0);
            // hack to avoid memory allocation
            hash.TransformFinalBlock(CipherSuite.EmptyArray, 0, 0);

            byte[] serverHash = this.ReadBytes((int)Length);
            byte[] clientHash = hash.Hash;

            // Check server prf against client prf
            if (!Compare(clientHash, serverHash))
            {
                throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid ServerFinished message received.");
            }
        }
示例#6
0
		protected override void ProcessAsSsl3()
		{
			// Compute handshake messages hashes
			HashAlgorithm hash = new SslHandshakeHash(this.Context.MasterSecret);

			byte[] data = this.Context.HandshakeMessages.ToArray ();
			hash.TransformBlock (data, 0, data.Length, data, 0);
			hash.TransformBlock (Ssl3Marker, 0, Ssl3Marker.Length, Ssl3Marker, 0);
			// hack to avoid memory allocation
			hash.TransformFinalBlock (CipherSuite.EmptyArray, 0, 0);

			byte[] serverHash	= this.ReadBytes((int)Length);			
			byte[] clientHash	= hash.Hash;
			
			// Check server prf against client prf
			if (!Compare (clientHash, serverHash))
			{
#warning Review that selected alert is correct
				throw new TlsException(AlertDescription.InsuficientSecurity, "Invalid ServerFinished message received.");
			}
		}