/// <summary>
        /// Decrypt the data using the given key and passed IV
        /// </summary>
        public static string DecryptData(SymmetricCipherResults cipherResults,
                                         SymmetricAlgorithmTypeEnum symmetricAlgorithm,
                                         string key)
        {
            key = SymmetricOperation.MakeKeyLegalSize(symmetricAlgorithm, key);

            byte[] IV = Convert.FromBase64String(cipherResults.IV);

            string PlainText = SymmetricOperation.DecryptFromBase64(symmetricAlgorithm,
                                                                    cipherResults.CipherText, key, IV, System.Text.Encoding.UTF8);

            return(PlainText);
        }
        /// <summary>
        /// Decrypt data from the secure string.
        /// </summary>
        public static string GetDataFromSecureString(string secretKey, byte[] bufInitVector, string base64Data)
        {
            secretKey = SymmetricOperation.MakeKeyLegalSize(AlgorithmType, secretKey);

            // Decrypt the secret string and make sure that is not expired
            string plainStr = SymmetricOperation.DecryptFromBase64(AlgorithmType,
                                                                   base64Data, secretKey, bufInitVector, ASCIIEncoding.ASCII);

            //Parse data to remove the salt and the expiration timestamp
            plainStr = plainStr.Substring(SaltLength);
            string   sExpirationTim  = plainStr.Substring(plainStr.Length - 14);
            DateTime dtExpirationTim = DateTime.ParseExact(sExpirationTim,
                                                           "yyyyMMddHHmmss",
                                                           System.Globalization.DateTimeFormatInfo.InvariantInfo);

            // Check if the contetn should expire
            if (dtExpirationTim > DateTime.Now)
            {
                return(plainStr.Substring(0, plainStr.Length - 14));
            }

            return(string.Empty);
            //Bad format
        }