コード例 #1
0
        public Task PassChallengeAsync(
            Span <byte> publicKey,
            Span <byte> generator,
            Span <byte> safePrime,
            Span <byte> salt)
        {
            _writer.Write((byte)AuthCommand.LogonChallenge);
            _writer.Write((byte)0);

            _writer.Write((byte)AuthStatus.Success);
            _writer.Write(publicKey.Slice(0, 32));
            _writer.Write((byte)generator.Length);
            _writer.Write(generator);
            _writer.Write((byte)safePrime.Length);
            _writer.Write(safePrime);
            _writer.Write(salt.Slice(0, 32));

            // 16 bytes of nothingness
            // TODO: figure out the purpose of this
            for (int i = 0; i < 16; i++)
            {
                _writer.Write((byte)0);
            }

            // security flags
            // TODO: provide these from a param
            _writer.Write((byte)0);

            return(_writer.FlushAsync());
        }