private HandshakeMessage ReadFinished(byte[] body)
        {
            var prfDigest = _cipherSuitesProvider.ResolvePRFHash(_cipherSuiteConfig.CipherSuite);
            var hash      = _handshakeConfig.ComputeVerification(prfDigest);

            return(FinishedMessage.Read(body, hash));
        }
        public FinishedMessage Generate()
        {
            if (_keyConfig.Master is null)
            {
                throw new InvalidOperationException("Key config is not initialized");
            }

            var prfDigest = _cipherSuitesProvider.ResolvePRFHash(_cipherSuiteConfig.CipherSuite);
            var prf       = new PRF(prfDigest);

            var label = _endConfig.End == ConnectionEnd.Server ? "server finished" : "client finished";
            var handshakeVerifyHash = _handshakeConfig.ComputeVerification(prfDigest);

            var verifyData =
                prf.Digest(_keyConfig.Master, label, handshakeVerifyHash)
                .Take(FinishedMessage.VerifyDataLength)
                .ToArray();

            return(new FinishedMessage(verifyData, handshakeVerifyHash));
        }