對稱加密與解密

2021-05-21 14:07:19 字數 1154 閱讀 7783

using system;

using system.collections.generic;

using system.linq;

using system.text;

using system.io;

using system.security.cryptography;

namespace encryptionanddecryption

/**/

///

/// 對稱加密類的建構函式

///

public rijndael_(string key, string iv)

/**/

///

/// 獲得金鑰

///

/// 金鑰

private byte getlegalkey()

/**/

///

/// 獲得初始向量iv

///

/// 初試向量iv

private byte getlegaliv()

/**/

///

/// 加密方法

///

/// 待加密的串

/// 經過加密的串

/// 待解密的串

/// 經過解密的串

/// 待加密的byte陣列

/// 經過加密的byte陣列

/// 待解密的byte陣列

/// 經過解密的byte陣列

/**/

///

/// 加密方法file to file

///

/// 待加密檔案的路徑

/// 待加密後檔案的輸出路徑

public void encrypt(string infilename, string outfilename)

cs.close();

fout.close();

fin.close();

/// 待解密檔案的路徑

/// 待解密後檔案的輸出路徑

public void decrypt(string infilename, string outfilename)

cs.close();

fout.close();

fin.close();}}

非對稱加密與解密

using system using system.collections.generic using system.linq using system.text using system.security.cryptography using system.io namespace encrypt...

對稱加密 解密

加密 public static class encrypting 使用對稱演算法加密 public static string symmetricencrypts string str 如需指定加密演算法,可在create 引數中指定字串 create 方法中的引數可以是 des rc2 syst...

對稱加密解密

幫助類 public class cryptohelper encryptor provider.createencryptor decryptor provider.createdecryptor initializes a new instance of the class.金鑰 public ...