public static void CreateKeyAndIv(out byte[] cryptKey, out byte[] iv) { using (var aes = CreateSymmetricAlgorithm()) { cryptKey = aes.Key; iv = aes.IV; } }