Ejemplo n.º 1
0
        internal byte[] Export()
        {
            if (Encoding.UTF8.GetBytes(Name).Length > short.MaxValue)
            {
                throw new Exception("Name too long. Must be within " + (short.MaxValue / 2) + " characters.");
            }

            var bytes = new List <byte>();
            var name  = Encoding.UTF8.GetBytes(Name);

            bytes.AddRange(BitConverter.GetBytes((short)name.Length));
            bytes.AddRange(name);
            var key = KeyData.Export();

            bytes.AddRange(BitConverter.GetBytes(key.Length));
            bytes.AddRange(key);

            var arr = bytes.ToArray();

            bytes.Clear();
            return(arr);
        }