Esempio n. 1
0
        public override bool Equals(object obj)
        {
            if (!(obj is RawAuthenticateResponse))
            {
                return(false);
            }
            if (this == obj)
            {
                return(true);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            RawAuthenticateResponse other = (RawAuthenticateResponse)obj;

            if (Counter != other.Counter)
            {
                return(false);
            }

            if (!Signature.SequenceEqual(other.Signature))
            {
                return(false);
            }
            return(UserPresence == other.UserPresence);
        }
Esempio n. 2
0
        public static uint FinishAuthentication(StartedAuthentication startedAuthentication, AuthenticateResponse response, DeviceRegistration deviceRegistration, HashSet <string> facets = null)
        {
            ClientData clientData = response.GetClientData();

            clientData.CheckContent(AuthenticateTyp, startedAuthentication.Challenge, facets);

            RawAuthenticateResponse authenticateResponse = RawAuthenticateResponse.FromBase64(response.SignatureData);

            authenticateResponse.CheckSignature(startedAuthentication.AppId, clientData.AsJson(), deviceRegistration.PublicKey);
            authenticateResponse.CheckUserPresence();

            return(deviceRegistration.CheckAndUpdateCounter(authenticateResponse.Counter));
        }