无法从ftp服务器C#解密文件 [英] Unable to decrypt the file from ftp server C#

查看:96
本文介绍了无法从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#解密文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆