Example #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);
        }
Example #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);
        }
		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);
		}
Example #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.");
            }
        }
Example #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.");
            }
        }
		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.");
			}
		}