Ejemplo n.º 1
0
 public string Decrypt(EncryptedText cipherText)
 {
     byte[] cipherBytes = cipherText.GetBytes();
     byte[] iv = cipherText.Iv;
     byte[] clearBytes = ProtectedData.Unprotect(cipherBytes, iv, DataProtectionScope.LocalMachine);
     return Encoding.UTF8.GetString(clearBytes);
 }
Ejemplo n.º 2
0
 public string Decrypt(EncryptedText cipherText)
 {
     byte[] cipherBytes = cipherText.GetBytes();
     byte[] iv          = cipherText.Iv;
     byte[] clearBytes  = ProtectedData.Unprotect(cipherBytes, iv, DataProtectionScope.LocalMachine);
     return(Encoding.UTF8.GetString(clearBytes));
 }
Ejemplo n.º 3
0
        public string Decrypt(EncryptedText cipherText)
        {
            _cipher.IV = cipherText.Iv;

            using (ICryptoTransform transform = _cipher.CreateDecryptor())
            {
                byte[] cipherBytes = cipherText.GetBytes();

                byte[] clearBytes = transform.TransformFinalBlock(cipherBytes, 0, cipherBytes.Length);

                return(Encoding.UTF8.GetString(clearBytes));
            }
        }
Ejemplo n.º 4
0
        public string Decrypt(EncryptedText cipherText)
        {
            _cipher.IV = cipherText.Iv;

            using (ICryptoTransform transform = _cipher.CreateDecryptor())
            {
                byte[] cipherBytes = cipherText.GetBytes();

                byte[] clearBytes = transform.TransformFinalBlock(cipherBytes, 0, cipherBytes.Length);

                return Encoding.UTF8.GetString(clearBytes);
            }
        }