DecryptData() public static method

public static DecryptData ( byte encryptedData ) : byte[]
encryptedData byte
return byte[]
Esempio n. 1
0
        public static object LoadFromFile(string fileName, Type t)
        {
            object o = null;

            try
            {
                byte[] fileContents = File.ReadAllBytes(fileName);

                byte[] decryptedData = Encryption.DecryptData(fileContents);

                using (MemoryStream stream = new MemoryStream())
                {
                    stream.Write(decryptedData, 0, decryptedData.Length);

                    stream.Position = 0;

                    DataContractSerializer serializer = new DataContractSerializer(t);

                    o = serializer.ReadObject(stream);
                }
            }
            catch (Exception ex)
            {
            }
            return(o);
        }
Esempio n. 2
0
        public static Config LoadFromFile(string fileName)
        {
            Config config = new Config();

            byte[] fileContents = File.ReadAllBytes(fileName);

            byte[] decryptedData = Encryption.DecryptData(fileContents);

            using (MemoryStream stream = new MemoryStream())
            {
                stream.Write(decryptedData, 0, decryptedData.Length);

                stream.Position = 0;

                DataContractSerializer serializer = new DataContractSerializer(typeof(Config));

                config = (Config)serializer.ReadObject(stream);
            }
            return(config);
        }