public override bool Equals(object obj)
        {
            if (!(obj is DeviceRegistration))
            {
                return(false);
            }

            DeviceRegistration other = (DeviceRegistration)obj;

            return(KeyHandle.SequenceEqual(other.KeyHandle) &&
                   PublicKey.SequenceEqual(other.PublicKey) &&
                   AttestationCert.SequenceEqual(other.AttestationCert) &&
                   (IsCompromised == other.IsCompromised));
        }
Example #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));
        }
Example #3
0
 public static StartedAuthentication StartAuthentication(string appId, DeviceRegistration deviceRegistration, byte[] challenge)
 {
     return(new StartedAuthentication(challenge.ByteArrayToBase64String(), appId, deviceRegistration.KeyHandle.ByteArrayToBase64String()));
 }
Example #4
0
 public static StartedAuthentication StartAuthentication(string appId, DeviceRegistration deviceRegistration)
 {
     byte[] challenge = Crypto.GenerateChallenge();
     return(StartAuthentication(appId, deviceRegistration, challenge));
 }