private FidoRegistrationData(FidoPublicKey userPublicKey, FidoKeyHandle keyHandle, FidoAttestationCertificate attestationCertificate, FidoSignature signature) { UserPublicKey = userPublicKey; KeyHandle = keyHandle; AttestationCertificate = attestationCertificate; Signature = signature; }
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"); } }
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"); } }
public FidoSignatureData(byte userPresence, uint counter, FidoSignature signature) { UserPresence = userPresence; Counter = counter; Signature = signature; }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { return(FidoSignature.FromWebSafeBase64(reader.Value.ToString())); }