Example #1
0
        public Task <IActionResult> DecipherDiffieHellman([FromForm] DiffieHellmanRequest obj)
        {
            if (obj.File.Length > 0)
            {
                if (!Directory.Exists(_environment.WebRootPath + "\\Cipher2\\"))
                {
                    Directory.CreateDirectory(_environment.WebRootPath + "\\Cipher2\\");
                }
                using var _fileStream = System.IO.File.Create(_environment.WebRootPath + "\\Cipher2\\" + obj.File.FileName);
                obj.File.CopyTo(_fileStream);
                _fileStream.Flush();
                _fileStream.Close();

                DiffieHellman diffie = new DiffieHellman(obj.PublicKey);
                caesar.Decipher(_environment.WebRootPath + "\\Cipher2\\" + obj.File.FileName, diffie.GetCommonKey(), _environment.WebRootPath + "\\Cipher2\\" + obj.Name + ".txt");

                return(DownloadZIP());
            }

            return(null);
        }
Example #2
0
 public void CipherDiffieHellman([FromForm] DiffieHellmanRequest obj)
 {
 }