Beispiel #1
0
 //private static readonly string embededKey = "MHA234@@$AV^&*^(ere5MHcc";
 public static string Encrypt(string strPlainText, string strKey24)
 {
     Symmetric sym = new Symmetric(Symmetric.Provider.TripleDES, true);
     EncryptionClassLibrary.Encryption.Data key = new EncryptionClassLibrary.Encryption.Data(strKey24);
     EncryptionClassLibrary.Encryption.Data encryptedData;
     encryptedData = sym.Encrypt(new EncryptionClassLibrary.Encryption.Data(strPlainText), key);
     return encryptedData.ToBase64();
 }
Beispiel #2
0
 public static string Decrypt(String strEncText, string strKey24)
 {
     Symmetric sym = new Symmetric(Symmetric.Provider.TripleDES, true);
     EncryptionClassLibrary.Encryption.Data key = new EncryptionClassLibrary.Encryption.Data(strKey24);
     EncryptionClassLibrary.Encryption.Data encryptedData = new EncryptionClassLibrary.Encryption.Data();
     encryptedData.Base64 = strEncText;
     EncryptionClassLibrary.Encryption.Data decryptedData = new EncryptionClassLibrary.Encryption.Data();
     decryptedData = sym.Decrypt(encryptedData, key);
     return decryptedData.ToString();
 }