Пример #1
0
        protected override byte[] GetFinishedMessage()
        {
            HandshakeMessage hm   = new HandshakeMessage(HandshakeType.Finished, new byte[36]);
            Ssl3HandshakeMac md5  = new Ssl3HandshakeMac(HashType.MD5, m_LocalMD5Hash, m_MasterSecret);
            Ssl3HandshakeMac sha1 = new Ssl3HandshakeMac(HashType.SHA1, m_LocalSHA1Hash, m_MasterSecret);

            md5.TransformFinalBlock(new byte[] { 0x53, 0x52, 0x56, 0x52 }, 0, 4);
            sha1.TransformFinalBlock(new byte[] { 0x53, 0x52, 0x56, 0x52 }, 0, 4);
            Buffer.BlockCopy(md5.Hash, 0, hm.fragment, 0, 16);
            Buffer.BlockCopy(sha1.Hash, 0, hm.fragment, 16, 20);
            md5.Clear();
            sha1.Clear();
            return(hm.ToBytes());
        }
Пример #2
0
        protected override byte[] GetFinishedMessage()
        {
            byte[] temp, hash = new byte[36];
            m_LocalMD5Hash.TransformFinalBlock(new byte[0], 0, 0);
            m_LocalSHA1Hash.TransformFinalBlock(new byte[0], 0, 0);
            Array.Copy(m_LocalMD5Hash.Hash, 0, hash, 0, 16);
            Array.Copy(m_LocalSHA1Hash.Hash, 0, hash, 16, 20);
            PseudoRandomDeriveBytes prf = new PseudoRandomDeriveBytes(m_MasterSecret, "server finished", hash);
            HandshakeMessage        hm  = new HandshakeMessage(HandshakeType.Finished, prf.GetBytes(12));

            temp = hm.ToBytes();
            prf.Dispose();
            return(temp);
        }
Пример #3
0
        protected override byte[] GetFinishedMessage()
        {
            HandshakeMessage hm = new HandshakeMessage(HandshakeType.Finished, null);

            byte[] hash = new byte[36];
            m_LocalMD5Hash.TransformFinalBlock(new byte[0], 0, 0);
            m_LocalSHA1Hash.TransformFinalBlock(new byte[0], 0, 0);
            Array.Copy(m_LocalMD5Hash.Hash, 0, hash, 0, 16);
            Array.Copy(m_LocalSHA1Hash.Hash, 0, hash, 16, 20);
            PseudoRandomDeriveBytes prf = new PseudoRandomDeriveBytes(m_MasterSecret, "client finished", hash);

            hm.fragment = prf.GetBytes(12);
            prf.Dispose();
            return(hm.ToBytes());
        }