Ejemplo n.º 1
0
        public unsafe void GenerateResumptionKey()
        {
            var timestamp = DateTime.UtcNow.ToBinary();
            var code      = stackalloc long[2];

            _provider.FillWithRandom(code, 16);
            code[0] = code[0] ^ timestamp;
            var key        = new byte[32];
            var nounceBase = new byte[12];

            _provider.FillWithRandom(key);
            _provider.FillWithRandom(nounceBase);

            var newKey = new ResumptionKey(code[0], code[1], key, nounceBase);

            AddNewKey(DateTime.UtcNow.AddHours(4), DateTime.UtcNow.AddHours(-1), newKey);
        }