Alexandria.Engines.DarkSouls.ArchiveFormat.LoadKey C# (CSharp) Method

LoadKey() static private method

static private LoadKey ( string filename, string type ) : byte[]
filename string
type string
return byte[]
        static byte[] LoadKey(string filename, string type)
        {
            var data = File.ReadAllBytes(filename);
            string pem = Encoding.ASCII.GetString(data);
            string header = String.Format("-----BEGIN {0}-----", type);
            string footer = String.Format("-----END {0}-----", type);
            int start = pem.IndexOf(header) + header.Length;
            int end = pem.IndexOf(footer, start);
            string base64 = pem.Substring(start, (end - start));
            return Convert.FromBase64String(base64);
        }