Example #1
0
        private void SendPrivateFile(Message message)
        {
            var  fileId   = message.StringMessage.Split('$').First();
            var  fileKey  = message.StringMessage.Split('$').Last();
            SHA1 hashCalc = SHA1.Create();
            var  keyHash  = ByteToStringConverter(hashCalc.ComputeHash(StringToByteConverter(fileKey)));
            var  filePath = _dbController.GetPrivateFilePath(fileId, keyHash);

            if (filePath == null)
            {
                SendResult(false, "Неверный ключ!");
                return;
            }
            if (!File.Exists(filePath))
            {
                SendResult(false, "Файл не найден на сервере!");
                return;
            }
            SendResult(true);
            _sslChannel.SendEncryptedFile(filePath, fileKey);
            SendResult(true);
        }