最近公司要做一个资料管理模块,因系统是C/S架构,原来小文件都是直接使用7Z压缩后保存到SQL Server数据库

而资料管理模块也就是文件上传,下载加权限管理,考虑文件较多,还可能比较大,所以打算在服务器上直接保存文件。

C/S上传文件到服务器,我知道的有几个实现方法:

1、使用IIS服务,通过B/S方式上传到服务器。这种方式需要服务器上部署IIS,提供WebServers服务,上传文件到指定目录后进行数据库编码保存。

2、使用FTP服务,服务端安装FTP服务器,客户端使用FTP类进行访问,好处是如果以后需要文件管理,可以直接使用现有的客户端进行管理。

3、使用TCP通讯方式上传下载。这种方式还需要处理很多问题。

经过几番查找,对比,决定使用第二种方式,使用开源的FileZilla 进行管理

使用FTP方式,就必须能实现服务端能在程序中控制,比如,在系统中添加用户,则服务器也同时能对FTP服务端添加用户操作,及权限分配。

经研究FileZilla Server使用XML配置文件管理,其分支结构非常清晰。

如图:

这是V9.46版本的配置文件,最新版本V9.60已修改了加密方式,添加了SHA512加密,方法还是一样,也可以直接使用C#生成。

static string md5(string a)
        {
            string pwd = "";
            MD5 md5 = MD5.Create();
            byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(a));
            for (int i = 0; i < s.Length; i++)
            {
                pwd = pwd + s[i].ToString("x2"); 
            }           
            return pwd;       
        }

此方法来源:http://blog.sina.com.cn/s/blog_589b38e70100rtse.html

修改配置文件后需要重新加载,使配置文件生效:

官方手册使用命令行方式    /reload-config 命令就可以重新加载数据了

-------------- "FileZilla Server.exe" Command-line arguments  ------------------Starting and stopping the service:

/start
/stop

Installing the service for manual startup:

/install

Installing the service for start at boot:

/install auto

Uninstalling service:

/uninstall

Reloading configuration at runtime:

/reload-config

重新加载参考:http://www.tuicool.com/articles/AzQBfmU

最新版本V6.0以后 密码生成:

代码:

string txt=@"<Root><salt>&lt;RhUrxf^l,VZ&amp;7I/rbT+V9ZIr@v\p&apos;^cEmPEWyYMjS8^&amp;HY1Z|J.2#u2Z}]HF0i9</salt></Root>";
XmlDocument xmldoc=new XmlDocument();
xmldoc.LoadXml(txt);

string oldPass="05087D2082B206535713C1D5BDCA35509BE70B8C4F513F7E5F9799187DCB7F366011DB51AFACC67D1035A8EE7C04C6C12E92A4330808DDA4FF9F9946A09076FA";
string pass="123";
string salt=xmldoc.ChildNodes[0].InnerText;
salt.Dump();
byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(pass+salt);

SHA512 sha512 = new SHA512CryptoServiceProvider();
byte[] retVal = sha512.ComputeHash(bytValue);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < retVal.Length; i++)
{
sb.Append(retVal[i].ToString("X2"));
}

bool isComp= ( oldPass==sb.ToString());
isComp.Dump();

FTP FileZilla Server 本地加密C# 实现的更多相关文章

  1. [备忘]Windows Server 2008 R2部署FTP FileZilla Server防火墙设置

    有一台服务器,之前文件迁移少,现准备用FileZilla Server当FTP服务器,服务器系统是Windows Server 2008 R2,同样适用FileZilla Client连接服务器FTP ...

  2. 服务器上装filezilla server后,本地的ftp客户端连接不上去

    公司一台服务器,上面装了filezilla server后,按平常配置好了,但是在本地用FTP客户端不管怎么连接都连接不上,本地FTP客户端总提示连接失败,远程filezilla server的界面也 ...

  3. Filezilla server配置FTP服务器中的各种问题与解决方法

    转至;https://www.jb51.net/article/122171.htm 安装文件以及补丁下载 公司很多资料需要通过ftp上传,那么就需要配置一个FTP服务器,找了一台Windows服务器 ...

  4. 使用FileZilla Server轻松搭建个人FTP服务器

    Linux平台下快速搭建FTP服务器 服务器FTP Server环境搭建 针对以上遇到的问题的解决方案如下: 1)如何上传文件到云服务器上          关于这个问题,我首先想到的是使用FileZ ...

  5. 【阿里云】在 Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务

     Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务 一.安装 Filezilla Server 下载最新版本的 Filezilla Server ...

  6. 使用filezilla server搭建FTP服务器

    参考文献 http://www.pc6.com/infoview/Article_51961_all.html 背景 需要在内网环境下搭建一个FTP服务器,查阅相关资料发现使用filezilla se ...

  7. 用FileZilla Server开FTP

    FileZilla(教程)是经典的开源FTP解决方案,包括FileZilla客户端和FileZilla Server.其中,FileZilla Server的功能比起商业软件FTP Serv-U毫不逊 ...

  8. FTP服务器FileZilla Server配置及使用方法

    FileZilla Server下载安装完成后,安装过程不写说明了,网上一抓一大把,直接从配置开始记录. 1.创建服务器 ²  Password:栏位中输入本服务器Filezilla服务的密码, ²  ...

  9. 免费ftp服务器FileZilla Server配置

    FileZilla Server下载安装完成后,必须启动软件进行设置,由于此软件是英文,本来就是一款陌生的软件,再加上英文,配置难度可想而知,小编从网上找到一篇非常详细的教程进行整理了一番,确保读到这 ...

随机推荐

  1. 4.SVM

  2. SDUT OJ 数据结构实验之二叉树二:遍历二叉树

    数据结构实验之二叉树二:遍历二叉树 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Descr ...

  3. css实现正方形div的3种方式

    网上百度了几种可以按照百分比画方框的方法 1.CSS3 vw 单位 1vw = 1% viewport width <div class="vw">hello,view ...

  4. SJTU 机试 数学

    题目描述 给定n,a求最大的k,使n!可以被a^k整除但不能被a^(k+1)整除. 输入描述: 两个整数n(2<=n<=1000),a(2<=a<=1000) 输出描述: 一个 ...

  5. 2、Numpy常用函数

    创建单位矩阵和读写文件使用eye()创建单位矩阵 # -*- coding: utf-8 -*- import numpy as np i = np.eye(3) print(i) 结果: [[ 1. ...

  6. 提交post请求,参数为xml格式

    import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import ...

  7. 【转】idea中maven模块编程灰色

    可能是设置中模块的pom.xml文件被忽略了 去掉对勾 转自:https://blog.csdn.net/ethan__xu/article/details/80794060

  8. POJ2248 Addition Chains 迭代加深

    不知蓝书的标程在说什么,,,,于是自己想了一下...发现自己的代码短的一批... 限制搜索深度+枚举时从大往小枚举,以更接近n+bool判重,避免重复搜索 #include<cstdio> ...

  9. 页面加载时的div动画

    用@keyframes(动画),实现页面加载时的div动画(不要用js控制,因为当页面加载的时候,js还不一定可以使用) 可以在https://daneden.github.io/animate.cs ...

  10. hdu-1022-栈

    Train Problem I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...