Пример #1
0
        public static string decrypt(RijndaelEncryptedResult encrypted)
        {
            // Decrypt the bytes to a string.
            string decryptString = decryptStringFromBytes_AES(encrypted.EncryptedData, encrypted.Key, encrypted.IV);

            return(decryptString);
        }
Пример #2
0
 public static RijndaelEncryptedResult encrypt(string original)
 {
     // Create a new instance of the RijndaelManaged
     // class.  This generates a new key and initialization
     // vector (IV).
     using (RijndaelManaged myRijndael = new RijndaelManaged())
     {
         // Encrypt the string to an array of bytes.
         byte[] encrypted = encryptStringToBytes_AES(original, myRijndael.Key, myRijndael.IV);
         RijndaelEncryptedResult result = new RijndaelEncryptedResult {
             EncryptedData = encrypted, Key = myRijndael.Key, IV = myRijndael.IV
         };
         return(result);
     }
 }