Exemple #1
0
        RegisterInfo GenerateRegisterInfo(RegisterRequest registerRequest)
        {
            var clientDataB64 = ClientDataCodec.EncodeClientData(ClientDataCodec.RequestTypeRegister, registerRequest.Challenge,
                                                                 sender.Origin, sender.ChannelId);
            var clientDataSha256 = crypto.ComputeSha256(clientDataB64);
            var appIdSha256      = crypto.ComputeSha256(registerRequest.AppId);

            return(new RegisterInfo(registerRequest, clientDataB64, new KeyRegisterRequest(appIdSha256, clientDataSha256)));
        }
        public static KeyRegisterRequest RegistrationRequestToRegisterRequest(string origin,
                                                                              RegisterRequest registerRequest, JObject channelIdJson, out string clientData,
                                                                              IClientCrypto crypto)
        {
            clientData = ClientDataCodec.EncodeClientData(ClientDataCodec.RequestTypeRegister, registerRequest.Challenge,
                                                          origin, channelIdJson);
            var clientDataSha256 = crypto.ComputeSha256(clientData);
            var appIdSha256      = crypto.ComputeSha256(registerRequest.AppId);

            return(new KeyRegisterRequest(appIdSha256, clientDataSha256));
        }
        public static KeySignRequest SignRequestToAuthenticateRequest(string origin, SignRequest signRequest, JObject channelIdJson,
                                                                      out string clientData, IClientCrypto crypto)
        {
            clientData = ClientDataCodec.EncodeClientData(ClientDataCodec.RequestTypeAuthenticate, signRequest.Challenge,
                                                          origin, channelIdJson);
            var clientDataSha256 = crypto.ComputeSha256(clientData);
            var appIdSha256      = crypto.ComputeSha256(signRequest.AppId);
            var keyHandle        = WebSafeBase64Converter.FromBase64String(signRequest.KeyHandle);

            return(new KeySignRequest(U2FVersion.V2,
                                      clientDataSha256, appIdSha256, keyHandle));
        }
Exemple #4
0
        SignInfo GenerateSignInfo(SignRequest signRequest)
        {
            var clientDataB64 = ClientDataCodec.EncodeClientData(ClientDataCodec.RequestTypeAuthenticate, signRequest.Challenge,
                                                                 sender.Origin, sender.ChannelId);
            var clientDataSha256 = crypto.ComputeSha256(clientDataB64);
            var appIdSha256      = crypto.ComputeSha256(signRequest.AppId);
            var keyHandle        = WebSafeBase64Converter.FromBase64String(signRequest.KeyHandle);
            var authRequest      = new KeySignRequest(U2FVersion.V2,
                                                      clientDataSha256, appIdSha256, keyHandle);

            return(new SignInfo(signRequest, clientDataB64, authRequest));
        }