Пример #1
0
 public static string Encrypt(string plain, string password)
 {
     var data = new QtvEncryptedData();
     data.SetSecret(password, SecretType.Password);
     data.Content = plain;
     var algorithm = data.Algorithm;
     algorithm.Name = EncryptionAlgorithm.RC4;
     algorithm.KeyLength = EncryptionKeyLength.Bits128;
     return data.Encrypt(EncodingType.Base64);
 }
Пример #2
0
 public static string Decrypt(string encrypted, string password)
 {
     var data = new QtvEncryptedData();
     var algorithm = data.Algorithm;
     algorithm.Name = EncryptionAlgorithm.RC4;
     algorithm.KeyLength = EncryptionKeyLength.Bits128;
     data.SetSecret(password, SecretType.Password);
     data.Decrypt(encrypted);
     return data.Content;
 }