DES 檔案加密解密

2021-10-23 20:48:28 字數 1076 閱讀 6372

public class desfileutils else

string file = newpath + filename;

//新建路徑,目標目錄為:原路徑/encypt

string path = newpath + "encypt" + file.separator;

file f = new file(path);

if(!f.exists())

string destfile = path + filename;

trycis.close();

is.close();

out.close();

}catch(exception e)

//返回加密後的檔案路徑

return destfile.tostring();

}/**

* 對加密檔案進行解密

* @param file 已加密的檔案

* @param dest 解密後的檔案(應與原始檔相同)

* @return 解密後的檔案路徑

* @throws exception

*/public string decrypt(string filepath, string filename, string key)throws exceptionelse

//待解密檔案路徑

string file = newpath + filename;

//解密後檔案路徑

filepath = newpath + "decypt" + file.separator;

file f = new file(filepath);

if(!f.exists())

string destfile = filepath + filename;

trycos.close();

out.close();

is.close();

logger.info("檔案解密成功");

}catch(exception e)

return destfile.tostring();

}

DES加密解密

using system using system.drawing using system.collections using system.componentmodel using system.windows.forms using system.data using system.io us...

DES加密解密

加密類 date 2012 04 23 pm.public class encrypt private encrypt 建立加密類物件.public static encrypt createcryptoserviceprovider des加密.待加密字串.加密金鑰.8位 public strin...

DES加密解密

using system.data using system.configuration using system.web using system.web.security using system.web.ui using system.web.ui.webcontrols using syst...