public static string DESEncryption(string plain, string key) { BCEngine bcEngine = new BCEngine(new DesEngine(), Global.UTF8); Pkcs7Padding padding = new Pkcs7Padding(); padding.Init(new SecureRandom()); bcEngine.SetPadding(padding); return bcEngine.Encrypt(plain, CheckKeyLength(key, 8)); }
public static string AESDecryption(string cipher, string key) { BCEngine bcEngine = new BCEngine(new AesEngine(), Global.UTF8); Pkcs7Padding padding = new Pkcs7Padding(); padding.Init(new SecureRandom()); bcEngine.SetPadding(padding); return bcEngine.Decrypt(cipher, CheckKeyLength(key, 32)); }