Example #1
0
 private FidoRegistrationData(FidoPublicKey userPublicKey, FidoKeyHandle keyHandle,
                              FidoAttestationCertificate attestationCertificate,
                              FidoSignature signature)
 {
     UserPublicKey          = userPublicKey;
     KeyHandle              = keyHandle;
     AttestationCertificate = attestationCertificate;
     Signature              = signature;
 }
Example #2
0
        private void VerifySignature(FidoDeviceRegistration deviceRegistration, FidoSignature signature,
                                     byte[] signedBytes)
        {
            try
            {
                var certPublicKey = deviceRegistration.PublicKey.PublicKey;
                var signer        = SignerUtilities.GetSigner("SHA-256withECDSA");
                signer.Init(false, certPublicKey);
                signer.BlockUpdate(signedBytes, 0, signedBytes.Length);

                if (signer.VerifySignature(signature.ToByteArray()))
                {
                    throw new InvalidOperationException("Invalid signature");
                }
            }
            catch
            {
                throw new InvalidOperationException("Invalid signature");
            }
        }
Example #3
0
        private void VerifySignature(FidoAttestationCertificate certificate, FidoSignature signature,
                                     byte[] signedBytes)
        {
            try
            {
                var certPublicKey = certificate.Certificate.GetPublicKey();
                var signer        = SignerUtilities.GetSigner("SHA-256withECDSA");
                signer.Init(false, certPublicKey);
                signer.BlockUpdate(signedBytes, 0, signedBytes.Length);

                if (signer.VerifySignature(signature.ToByteArray()))
                {
                    throw new InvalidOperationException("Invalid signature");
                }
            }
            catch (Exception)
            {
                throw new InvalidOperationException("Invalid signature");
            }
        }
Example #4
0
 public FidoSignatureData(byte userPresence, uint counter, FidoSignature signature)
 {
     UserPresence = userPresence;
     Counter      = counter;
     Signature    = signature;
 }
Example #5
0
 public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
 {
     return(FidoSignature.FromWebSafeBase64(reader.Value.ToString()));
 }