Пример #1
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));
        }
Пример #2
0
        public override bool Equals(object obj)
        {
            if (!(obj is StartedAuthentication))
            {
                return(false);
            }
            if (this == obj)
            {
                return(true);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            StartedAuthentication other = (StartedAuthentication)obj;

            if (AppId == null)
            {
                if (other.AppId != null)
                {
                    return(false);
                }
            }
            else if (!AppId.Equals(other.AppId))
            {
                return(false);
            }
            if (Challenge == null)
            {
                if (other.Challenge != null)
                {
                    return(false);
                }
            }
            else if (!Challenge.Equals(other.Challenge))
            {
                return(false);
            }
            if (KeyHandle == null)
            {
                if (other.KeyHandle != null)
                {
                    return(false);
                }
            }
            else if (!KeyHandle.Equals(other.KeyHandle))
            {
                return(false);
            }
            if (Version == null)
            {
                if (other.Version != null)
                {
                    return(false);
                }
            }
            else if (!Version.Equals(other.Version))
            {
                return(false);
            }
            return(true);
        }