无法从ftp服务器C#解密文件

编程入门 行业动态 更新时间:2024-10-24 04:48:26
本文介绍了无法从ftp服务器C#解密文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

/我hvae写下加密代码,我试图使用client.upload解密文件,但我无法做同样的事情。请建议 我尝试过:

Hi, /I hvae written below code for encryption and i am trying to decrypt the file using client.upload but i am unable to do the same.please suggest What I have tried:

IEnumerable<string> files = Directory.EnumerateFiles(@"E:\\Folder1"); using (WebClient client = new WebClient()) { client.Credentials = new NetworkCredential("username", "password"); //encrypr datetime. upload_encryption.AES a = new AES(); foreach (string file in files) { FileInfo file1=new FileInfo(file); a.EncryptFile(file.ToString(),"D:\\test"+file1.Extension,"passwd"); client.UploadFile("ftp://192." + Path.GetFileName(file), "D:\\test"+file1.Extension); File.Delete("D:\\test"+file1.Extension); FileInfo file2= new FileInfo(file); a.DecryptFile("ftp://192..... ","D:\\test"+file2.Extension,"passwd"); client.DownloadFile("ftp://192./"+Path.GetFileName(file),"D:\\test"+file2.Extension); //File.Delete("D:\\test"+file2.Extension); } } } catch(Exception e) { }

推荐答案

首先做两件事: 1)检查密码。 2)使用现有代码加密文件,并在本地保存。然后使用上面的代码在本地解密它,并比较结果。如果它们匹配,则需要查看FTP进程,如果要获取正确的文件,则在传输过程中或存储时没有损坏,等等。如果他们不这样做,那么您需要查看加密解密代码才能找到问题。 很抱歉,但我们不能为您做任何事情! Start by doing two things: 1) Check your password. 2) Encrypt the file using your existing code, and save it locally. Then use the code above to decrypt it locally, and compare the results. If they match, you need to look at the FTP process and if you are fetching the right file, that is hasn't been corrupted in transfer, or when you stored it, and so forth. If they don't, then you need to look at your encryption and decryption code to find the problem. Sorry, but we can't do any of that for you!

更多推荐

无法从ftp服务器C#解密文件

本文发布于:2023-11-07 22:41:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1567637.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:服务器   文件   ftp

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!