Example #1
0
        public string ReadString(bool withEncrypt = false, string algorithm = "AES", string password = "******")
        {
            string data = "";

            using (FileStream fs = new FileStream(this.FileName, FileMode.Open, FileAccess.Read))
                using (StreamReader srd = new StreamReader(fs))
                {
                    if (withEncrypt)
                    {
                        Symmetric sym = new Symmetric(CryptoFactory.GetSymmetricInstance(algorithm, password));
                        data = sym.DecryptString(srd.ReadToEnd());
                    }
                    else
                    {
                        data = srd.ReadToEnd();
                    }
                }
            return(data);
        }
Example #2
0
        private void btnDecryptTripleDES_Click(object sender, EventArgs e)
        {
            Symmetric sym = new Symmetric(CryptoFactory.GetSymmetricInstance("TripleDES", "12345678"));

            txtDecrypted.Text = sym.DecryptString(txtEncrypted.Text);
        }
Example #3
0
        private void btnDecryptAES_Click(object sender, EventArgs e)
        {
            Symmetric sym = new Symmetric(CryptoFactory.GetSymmetricInstance("AES", "tumsakal_0963189366"));

            txtDecrypted.Text = sym.DecryptString(txtEncrypted.Text);
        }