public virtual void TestRegister()
        {
            var registerRequest  = new KeyRegisterRequest(APP_ID_ENROLL_SHA256, BROWSER_DATA_ENROLL_SHA256);
            var registerResponse = u2FKey.Register(registerRequest);

            mockDataStore.Verify(x => x.StoreKeyPair(KEY_HANDLE, USER_KEY_PAIR_ENROLL));
            CollectionAssert.AreEqual(USER_PUBLIC_KEY_ENROLL_HEX, registerResponse.UserPublicKey);
            Assert.AreEqual(VENDOR_CERTIFICATE, registerResponse.AttestationCertificate);
            CollectionAssert.AreEqual(KEY_HANDLE, registerResponse.KeyHandle);
            var ecdsaSignature = SignerUtilities.GetSigner("SHA-256withECDSA");

            ecdsaSignature.Init(false, VENDOR_CERTIFICATE.GetPublicKey());
            ecdsaSignature.BlockUpdate(EXPECTED_REGISTER_SIGNED_BYTES, 0, EXPECTED_REGISTER_SIGNED_BYTES.Length);
            Assert.IsTrue(ecdsaSignature.VerifySignature(registerResponse.Signature));
        }
        public void Register(string origin, string accountName)
        {
            var registrationRequest = server.GetRegistrationRequest(accountName, origin);

            if (!registrationRequest.Version.Equals(U2FConsts.U2Fv2))
            {
                throw new U2FException($"Unsupported protocol version: {registrationRequest.Version}");
            }
            appIdVerifier.ValidateOrigin(registrationRequest.AppId, origin);
            var    channelIdJson = channelIdProvider.GetJsonChannelId();
            string clientData;
            var    registerRequest           = RegistrationRequestToRegisterRequest(origin, registrationRequest, channelIdJson, out clientData, crypto);
            var    registerResponse          = key.Register(registerRequest);
            var    rawRegisterResponse       = RawMessageCodec.EncodeKeyRegisterResponse(registerResponse);
            var    rawRegisterResponseBase64 = WebSafeBase64Converter.ToBase64String(rawRegisterResponse);
            var    clientDataBase64          = WebSafeBase64Converter.ToBase64String(Encoding.UTF8.GetBytes(clientData));

            server.ProcessRegistrationResponse(
                new RegisterResponse(rawRegisterResponseBase64, clientDataBase64, registrationRequest.SessionId),
                clock.Now.ToUnixTimeMilliseconds());
        }