public string DecryptWithSessionB64(string encryptedB64) { byte[] encrypted = Convert.FromBase64String(encryptedB64); byte[] IV = new byte[16]; byte[] encryptedWOIV = new byte[encrypted.Length - 16]; //Copy from encrypted to IV, IV size bytes (must be 32) Array.Copy(encrypted, IV, 16); //Copy from encrypted to encryptedWOIV[32], encrypted size bytes - IV size bytes (must be 32) Array.Copy(encrypted, 16, encryptedWOIV, 0, encrypted.Length - 16); return(SCSC_AES.Decrypt(encryptedWOIV, m_sessionPassword, IV)); }
//AES256 with key from SHA256 of user's password used for encrypt/decrypt user data public string DecryptUserDataB64(string encryptedB64) { byte[] encrypted = Convert.FromBase64String(encryptedB64); return(SCSC_AES.Decrypt(encrypted, m_shaPassword, m_shaUser)); }