Skip to content

Commit

Permalink
clear validated when registering new user.
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferStrube committed Dec 27, 2023
1 parent 32197ab commit 2217fbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,14 @@ public static bool VerifySignature(COSEAlgorithm publicKeyAlgorithm, byte[] publ
{
if (publicKeyAlgorithm is COSEAlgorithm.ES256)
{
var dsa = ECDsa.Create(new ECParameters
{
Curve = ECCurve.NamedCurves.nistP256,
Q = new()
{
X = publicKey.Take(32).ToArray(),
Y = publicKey.Skip(32).ToArray()
}
});
var dsa = ECDsa.Create();
dsa.ImportSubjectPublicKeyInfo(publicKey, out _);

var Hash = SHA256.Create();

byte[] hashedClientData = Hash.ComputeHash(Convert.FromBase64String(clientData));

bool result = dsa.VerifyData(Convert.FromBase64String(authenticatorData).Concat(hashedClientData).ToArray(), Convert.FromBase64String(signature), HashAlgorithmName.SHA256);
bool result = dsa.VerifyData(Convert.FromBase64String(authenticatorData).Concat(hashedClientData).ToArray(), Convert.FromBase64String(signature), HashAlgorithmName.SHA256, DSASignatureFormat.Rfc3279DerSequence);

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ private async Task CreateCredential()
}

errorMessage = null;
validated = null;
}
catch (DOMException exception)
{
Expand Down

0 comments on commit 2217fbc

Please sign in to comment.